********************************************************************************
** 	TITLE:		merge_contact_networks                                        ** 	
**	DATA:       Various election studies                                      **
**	AUTHOR:	    Philippe Mongrain                                             **
**	DATE:		October 2022 					                              **	
**	VERSION:	Stata 16					                                  **
********************************************************************************

* Version control

version 16.0

* AUTNES 2013 - NATIONAL

use "at2013_autnes.dta", clear

keep pagnr correct_whole_d discussion discussion_3pts coalscale interest news knowledge age male education time

rename pagnr origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "at2013-AUTNES-N"

nearmrg using "at2013_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "at2013_autnes_merge_F.dta", replace

* AUTNES 2017 - NATIONAL

use "at2017_autnes.dta", clear

keep id correctW4_whole_d discussionW4 discussionW4_3pts disagreementW4 disagreementW4_3pts sizeW4 sizeW4_3pts coalscaleW4 interestW4 news age male education timeW4

rename id origid
rename correctW4_whole_d forecast
rename discussionW4 discussion
rename discussionW4_3pts discussion_3pts
rename disagreementW4 disagreement
rename disagreementW4_3pts disagreement_3pts
rename sizeW4 size
rename sizeW4_3pts size_3pts
rename coalscaleW4 wishful
rename interestW4 interest
rename timeW4 time

gen study_id = "at2017-AUTNES-N"

nearmrg using "at2017_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "at2017_autnes_merge_F.dta", replace

* BB-GLES 2014 - REGIONAL

use "bb2014_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts expertise coalscale interest age male education time

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "bb2014-GLES-R"

nearmrg using "bb2014_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "bb2014_gles_merge_F.dta", replace

* BW-GLES 2016 - REGIONAL

use "bw2016_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts expertise coalscale interest age male education time

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "bw2016-GLES-R"

nearmrg using "bw2016_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "bw2016_gles_merge_F.dta", replace

* BY-GLES 2013 - REGIONAL

use "by2013_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts expertise coalscale interest age male education time

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "by2013-GLES-R"

nearmrg using "by2013_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "by2013_gles_merge_F.dta", replace

* CES 1988 - NATIONAL

use "ca1988_ces.dta", clear

keep idnum correct_whole_d discussion pidscale_whole interest_election news age male education time

rename idnum origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename interest_election interest

gen study_id = "ca1988-CES-N"

nearmrg using "ca1988_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "ca1988_ces_national_merge_F.dta", replace

* CES 1988 - DISTRICT

use "ca1988_ces.dta", clear

keep idnum correct_district_d discussion pidscale_district interest_election news age male education time enep margin district_code

rename idnum origid
rename correct_district_d forecast
rename pidscale_district wishful
rename interest_election interest

gen study_id = "ca1988-CES-D"

save "ca1988_ces_district_merge_F.dta", replace

* CES 1993 - NATIONAL

use "ca1993_ces.dta", clear

keep idnum correct_whole_d discussion pidscale_whole interest news age male education time

rename idnum origid
rename correct_whole_d forecast
rename pidscale_whole wishful

gen study_id = "ca1993-CES-N"

nearmrg using "ca1993_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "ca1993_ces_merge_F.dta", replace

* CES 1997 - NATIONAL

use "ca1997_ces.dta", clear

keep idnum correct_whole_d discussion disagreement pidscale_whole interest news knowledge age male education time

rename idnum origid
rename correct_whole_d forecast
rename pidscale_whole wishful

gen study_id = "ca1997-CES-N"

nearmrg using "ca1997_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "ca1997_ces_merge_F.dta", replace

* CES 2000 - DISTRICT

use "ca2000_ces.dta", clear

keep idnum correct_district_d discussion pidscale_district interest news knowledge age male education time enep margin reelected fed96

rename idnum origid
rename correct_district_d forecast
rename pidscale_district wishful
rename fed96 district_code

gen study_id = "ca2000-CES-D"

save "ca2000_ces_merge_F.dta", replace

* CES 2004 - NATIONAL

use "ca2004_2008_ces.dta", clear

keep if ces_year == 2004 

keep ces04_idnum CA04_correct_whole_d CA04_discussion CA04_discussion CA04_size CA04_size_3pts CA04_size CA04_pidscale_whole CA04_interest CA04_news CA04_knowledge CA04_male CA04_age CA04_education CA04_time ces_year

rename ces04_idnum origid
rename CA04_correct_whole_d forecast
rename CA04_discussion discussion
rename CA04_size size
rename CA04_size_3pts size_3pts
rename CA04_pidscale_whole wishful
rename CA04_interest interest
rename CA04_news news
rename CA04_knowledge knowledge
rename CA04_male male
rename CA04_age age
rename CA04_education education
rename CA04_time time

gen study_id = "ca2004-CES-N"

nearmrg using "ca2004_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "ca2004_ces_national_merge_F.dta", replace

* CES 2004 - DISTRICT

use "ca2004_2008_ces.dta", clear

keep if ces_year == 2004 

keep ces04_idnum CA04_correct_district_d CA04_discussion CA04_size CA04_size_3pts CA04_pidscale_district CA04_interest CA04_news CA04_knowledge CA04_male CA04_age CA04_education CA04_time CA04_enep CA04_margin ces04_fed03 ces_year

rename ces04_idnum origid
rename CA04_correct_district_d forecast
rename CA04_discussion discussion
rename CA04_size size
rename CA04_size_3pts size_3pts
rename CA04_pidscale_district wishful
rename CA04_interest interest
rename CA04_news news
rename CA04_knowledge knowledge
rename CA04_male male
rename CA04_age age
rename CA04_education education
rename CA04_time time
rename CA04_enep enep
rename CA04_margin margin
rename ces04_fed03 district_code

gen study_id = "ca2004-CES-D"

save "ca2004_ces_district_merge_F.dta", replace

* CES 2006 - NATIONAL

use "ca2004_2008_ces.dta", clear

keep if ces_year == 2006

keep ces06_idnum CA06_correct_whole_d CA06_discussion CA06_discussion CA06_pidscale_whole CA06_interest CA06_news CA06_knowledge CA06_male CA06_age CA06_education CA06_time ces_year

rename ces06_idnum origid
rename CA06_correct_whole_d forecast
rename CA06_discussion discussion
rename CA06_pidscale_whole wishful
rename CA06_interest interest
rename CA06_news news
rename CA06_knowledge knowledge
rename CA06_male male
rename CA06_age age
rename CA06_education education
rename CA06_time time

gen study_id = "ca2006-CES-N"

nearmrg using "ca2006_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "ca2006_ces_national_merge_F.dta", replace

* CES 2006 - DISTRICT

use "ca2004_2008_ces.dta", clear

keep if ces_year == 2006

keep ces06_idnum CA06_correct_district_d CA06_discussion CA06_pidscale_district CA06_interest CA06_news CA06_knowledge CA06_male CA06_age CA06_education CA06_time CA06_enep CA06_margin ces06_fed03 ces_year

rename ces06_idnum origid
rename CA06_correct_district_d forecast
rename CA06_discussion discussion
rename CA06_pidscale_district wishful
rename CA06_interest interest
rename CA06_news news
rename CA06_knowledge knowledge
rename CA06_male male
rename CA06_age age
rename CA06_education education
rename CA06_time time
rename CA06_enep enep
rename CA06_margin margin
rename ces06_fed03 district_code

gen study_id = "ca2006-CES-D"

save "ca2006_ces_district_merge_F.dta", replace

* CES 2008 - NATIONAL

use "ca2004_2008_ces.dta", clear

keep if ces_year == 2008

keep ces08_idnum CA08_correct_whole_d CA08_discussion2 CA08_discussion2_3pts CA08_size CA08_size_3pts CA08_pidscale_whole CA08_interest CA08_news CA08_knowledge CA08_male CA08_age CA08_education CA08_time ces_year

rename ces08_idnum origid
rename CA08_correct_whole_d forecast
rename CA08_discussion2 discussion
rename CA08_discussion2_3pts discussion_3pts
rename CA08_size size
rename CA08_size_3pts size_3pts
rename CA08_pidscale_whole wishful
rename CA08_interest interest
rename CA08_news news
rename CA08_knowledge knowledge
rename CA08_male male
rename CA08_age age
rename CA08_education education
rename CA08_time time

gen study_id = "ca2008-CES-N"

nearmrg using "ca2008_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "ca2008_ces_national_merge_F.dta", replace

* CES 2008 - DISTRICT

use "ca2004_2008_ces.dta", clear

keep if ces_year == 2008

keep ces08_idnum CA08_correct_district_d CA08_discussion2 CA08_discussion2_3pts CA08_size CA08_size_3pts CA08_pidscale_district CA08_interest CA08_news CA08_knowledge CA08_male CA08_age CA08_education CA08_time CA08_enep CA08_margin ces08_fed03 ces_year

rename ces08_idnum origid
rename CA08_correct_district_d forecast
rename CA08_discussion2 discussion
rename CA08_discussion2_3pts discussion_3pts
rename CA08_size size
rename CA08_size_3pts size_3pts
rename CA08_pidscale_district wishful
rename CA08_interest interest
rename CA08_news news
rename CA08_knowledge knowledge
rename CA08_male male
rename CA08_age age
rename CA08_education education
rename CA08_time time
rename CA08_enep enep
rename CA08_margin margin
rename ces08_fed03 district_code

gen study_id = "ca2008-CES-D"

save "ca2008_ces_district_merge_F.dta", replace

* CES 2011 - NATIONAL

use "ca2011_ces.dta", clear

keep CES11_IDNUM correct_whole_d discussion2 discussion2_3pts disagreement disagreement_3pts size size_3pts pidscale_whole interest age male education time

rename CES11_IDNUM origid
rename correct_whole_d forecast
rename discussion2 discussion
rename discussion2_3pts discussion_3pts 
rename pidscale_whole wishful

gen study_id = "ca2011-CES-N"

nearmrg using "ca2011_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "ca2011_ces_national_merge_F.dta", replace

* CES 2011 - DISTRICT

use "ca2011_ces.dta", clear

keep CES11_IDNUM correct_district_d discussion2 discussion2_3pts disagreement disagreement_3pts size size_3pts pidscale_district interest age male education time enep margin reelected fed11

rename CES11_IDNUM origid
rename correct_district_d forecast
rename discussion2 discussion
rename discussion2_3pts discussion_3pts
rename pidscale_district wishful
rename fed11 district_code

gen study_id = "ca2011-CES-D"

save "ca2011_ces_district_merge_F.dta", replace

* CES 2019 - NATIONAL #1

use "ca2019_ces.dta", clear

keep cps19_ResponseId correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts pidscale_whole interest education age male time

rename cps19_ResponseId origid
rename correct_whole_d forecast
rename pidscale_whole wishful

gen study_id = "ca2019-CES-N1"

nearmrg using "ca2019_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "ca2019_ces_mostseats_merge_F.dta", replace

* CES 2019 - NATIONAL #2

use "ca2019_ces.dta", clear

keep cps19_ResponseId correct_lpc_minority_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts pidscale_whole interest education age male time

rename cps19_ResponseId origid
rename correct_lpc_minority_d forecast
rename pidscale_whole wishful

gen study_id = "ca2019-CES-N2"

nearmrg using "ca2019_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "ca2019_ces_majority_merge_F.dta", replace

* CES 2019 - DISTRICT

use "ca2019_ces.dta", clear

keep cps19_ResponseId correct_district_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts pidscale_district interest education age male enep margin reelected time constituencynumber 

rename cps19_ResponseId origid
rename correct_district_d forecast
rename pidscale_district wishful
rename constituencynumber district_code

gen study_id = "ca2019-CES-D"

save "ca2019_ces_district_merge_F.dta", replace

* CMES MONTREAL 2017 - MUNICIPAL

use "mtl2017_qc2017_cmes.dta", clear

keep if CITY == 2

keep ResPIN MTL17_correct_whole_d discussion discussion_3pts MTL17_mayorprefC MTL17_mayorpref interest knowledge male age education time CITY

rename ResPIN origid
rename MTL17_correct_whole_d forecast
rename MTL17_mayorprefC wishful
rename MTL17_mayorpref mayorpref

gen study_id = "mtl2017-CMES-M"

nearmrg using "mtl2017_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "mtl2017_cmes_merge_F.dta", replace

* CMES QUEBEC CITY 2017 - MUNICIPAL

use "mtl2017_qc2017_cmes.dta", clear

keep if CITY == 3

keep ResPIN QC17_correct_whole_d discussion discussion_3pts QC17_mayorprefE QC17_mayorpref interest knowledge male age education time CITY

rename ResPIN origid
rename QC17_correct_whole_d forecast
rename QC17_mayorprefE wishful
rename QC17_mayorpref mayorpref

gen study_id = "qc2017-CMES-M"

nearmrg using "qc2017_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "qc2017_cmes_merge_F.dta", replace

* SKPES 2020 - REGIONAL

use "sk2020_skpes.dta", clear

keep ResponseId correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts pidscale_whole interest news education age male time

rename ResponseId origid
rename correct_whole_d forecast
rename pidscale_whole wishful

gen study_id = "sk2020-SKPES-R"

nearmrg using "sk2020_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "sk2020_skpes_regional_merge_F.dta", replace

* CA-Ipsos 2011 - NATIONAL

use "ca2011_ipsos.dta", clear

keep respid correct_whole_d discussion discussion_3pts vote_whole r_age male education time

rename respid origid
rename correct_whole_d forecast
rename vote_whole wishful
rename r_age age

gen study_id = "ca2011-Ipsos-N"

nearmrg using "ca2011_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "ca2011_ipsos_national_merge_F.dta", replace

* CA-Ipsos 2011 - DISTRICT

use "ca2011_ipsos.dta", clear

keep respid correct_district_d discussion discussion_3pts vote_district r_age male education enep margin reelected time riding 

rename respid origid
rename correct_district_d forecast
rename vote_district wishful
rename r_age age
rename riding district_code

gen study_id = "ca2011-Ipsos-D"

save "ca2011_ipsos_district_merge_F.dta", replace

* CA-Ipsos 2015 - NATIONAL

use "ca2015_ipsos.dta", clear

keep id correct_whole_d discussion discussion_3pts vote_whole r_age male education time

rename id origid
rename correct_whole_d forecast
rename vote_whole wishful
rename r_age age

gen study_id = "ca2015-Ipsos-N"

nearmrg using "ca2015_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "ca2015_ipsos_national_merge_F.dta", replace

* CA-Ipsos 2015 - DISTRICT

use "ca2015_ipsos.dta", clear

keep id correct_district_d discussion discussion_3pts vote_district r_age male education enep margin time riding 

rename id origid
rename correct_district_d forecast
rename vote_district wishful
rename r_age age
rename riding district_code

gen study_id = "ca2015-Ipsos-D"

save "ca2015_ipsos_district_merge_F.dta", replace

* GFES 2002 - NATIONAL

use "de2002_gfes.dta", clear

keep id correct_whole_d discussion discussion_3pts pidscale_whole interest age male education time

rename id origid
rename correct_whole_d forecast
rename pidscale_whole wishful

gen study_id = "de2002-GFES-N"

nearmrg using "de2002_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "de2002_gfes_merge_F.dta", replace

* DE-GLES 2009 - NATIONAL

use "de2009_gles.dta", clear

keep lfd correct_whole_d discussion discussion_3pts disagreement disagreement_3pts expertise expertise_4pts coalscale interest care_whole age male education time

rename lfd origid
rename correct_whole_d forecast
rename coalscale wishful
rename care_whole care

gen study_id = "de2009-GLES-N"

nearmrg using "de2009_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "de2009_gles_national_merge_F.dta", replace

* DE-GLES 2009 - DISTRICT

use "de2009_gles.dta", clear

keep lfd correct_district_d discussion discussion_3pts disagreement disagreement_3pts expertise pidscale_district interest age male education time enep margin reelected wkrnr

rename lfd origid
rename correct_district_d forecast
rename pidscale_district wishful
rename wkrnr district_code

gen study_id = "de2009-GLES-D"

save "de2009_gles_district_merge_F.dta", replace

* DE-GLES 2013 - NATIONAL

use "de2013_gles.dta", clear

keep vlfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts expertise expertise_4pts size size_3pts coalscale interest care_whole knowledge age male education time

rename vlfdn origid
rename correct_whole_d forecast
rename coalscale wishful
rename care_whole care

gen study_id = "de2013-GLES-N"

nearmrg using "de2013_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "de2013_gles_national_merge_F.dta", replace

* DE-GLES 2013 - DISTRICT

use "de2013_gles.dta", clear

keep vlfdn correct_district_d discussion discussion_3pts disagreement disagreement_3pts expertise expertise_4pts size size_3pts pidscale_district interest knowledge age male education time enep margin reelected elecdist

rename vlfdn origid
rename correct_district_d forecast
rename pidscale_district wishful
rename elecdist district_code

gen study_id = "de2013-GLES-D"

save "de2013_gles_district_merge_F.dta", replace

* DE-GLES 2017 - NATIONAL

use "de2017_gles.dta", clear

keep vlfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts expertise expertise_4pts size size_3pts coalscale interest care_whole knowledge age male education time

rename vlfdn origid
rename correct_whole_d forecast
rename coalscale wishful
rename care_whole care

gen study_id = "de2017-GLES-N"

nearmrg using "de2017_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "de2017_gles_national_merge_F.dta", replace

* DE-GLES 2017 - DISTRICT

use "de2017_gles.dta", clear

keep vlfdn correct_district_d discussion discussion_3pts disagreement disagreement_3pts expertise expertise_4pts size size_3pts pidscale_district interest knowledge age male education time enep margin reelected wahlkreis

rename vlfdn origid
rename correct_district_d forecast
rename pidscale_district wishful
rename wahlkreis district_code

gen study_id = "de2017-GLES-D"

save "de2017_gles_district_merge_F.dta", replace

* DE-GLES 2021 - NATIONAL

use "de2021_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts coalscale interest care_whole age male education time

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful
rename care_whole care

gen study_id = "de2021-GLES-N"

nearmrg using "de2021_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "de2021_gles_national_merge_F.dta", replace

* DE-GLES 2021 - DISTRICT

use "de2021_gles.dta", clear

keep lfdn correct_district_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts pidscale_district interest age male education time enep margin reelected wknr

rename lfdn origid
rename correct_district_d forecast
rename pidscale_district wishful
rename wknr district_code

gen study_id = "de2021-GLES-D"

save "de2021_gles_district_merge_F.dta", replace

* CIS 2016 - NATIONAL

use "es2016_cis.dta", clear

keep cues correct_whole_d discussion discussion_3pts party interest age male education time

rename cues origid
rename correct_whole_d forecast
rename party wishful

gen study_id = "es2016-CIS-N"

nearmrg using "es2016_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "es2016_cis_merge_F.dta", replace

* CIS Apr2019 - NATIONAL

use "esA2019_cis.dta", clear

keep cues correct_whole_d discussion discussion_3pts party interest age male education time

rename cues origid
rename correct_whole_d forecast
rename party wishful

gen study_id = "esA2019-CIS-N"

nearmrg using "esA2019_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "esA2019_cis_merge_F.dta", replace

* CIS Nov2019 - NATIONAL

use "esN2019_cis.dta", clear

keep cues correct_whole_d discussion discussion_3pts party interest age male education time

rename cues origid
rename correct_whole_d forecast
rename party wishful

gen study_id = "esN2019-CIS-N"

nearmrg using "esN2019_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "esN2019_cis_merge_F.dta", replace

* BES 1963 - NATIONAL

use "gb1964_bes.dta", clear

keep v2 GB63_correct_whole_d GB63_discussion GB63_pidscale_whole GB63_interest GB63_news GB63_care_whole GB63_age GB63_male GB63_education GB63_time

rename v2 origid
rename GB63_correct_whole_d forecast
rename GB63_discussion discussion
rename GB63_pidscale_whole wishful
rename GB63_interest interest
rename GB63_news news
rename GB63_care_whole care
rename GB63_age age
rename GB63_male male
rename GB63_education education
rename GB63_time time

gen study_id = "gb1964-BES-N"

nearmrg using "gb1964_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "gb1964_bes_national_merge_F.dta", replace

* BES 1963 - DISTRICT

use "gb1964_bes.dta", clear

keep v2 GB63_correct_district_d GB63_discussion GB63_pidscale_district GB63_interest GB63_news GB63_age GB63_male GB63_education GB63_time GB63_enep GB63_margin GB63_reelected v31

rename v2 origid
rename GB63_correct_district_d forecast
rename GB63_discussion discussion
rename GB63_pidscale_district wishful
rename GB63_interest interest
rename GB63_news news
rename GB63_age age
rename GB63_male male
rename GB63_education education
rename GB63_time time
rename GB63_enep enep
rename GB63_margin margin
rename GB63_reelected reelected
rename v31 district_code

gen study_id = "gb1964-BES-D"

save "gb1964_bes_district_merge_F.dta", replace

* BES 1987 - NATIONAL

use "gb1987_bes.dta", clear

keep resp correct_whole_d discussion discussion_3pts pidscale_whole election_interest age male time

rename resp origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename election_interest interest

gen study_id = "gb1987-BES-N"

nearmrg using "gb1987_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "gb1987_bes_merge_F.dta", replace

* BES 2005 - NATIONAL

use "gb2005_bes.dta", clear

keep serialno correct_whole_d discussion discussion_3pts disagreement disagreement_3pts pidscale_whole interest knowledge care_whole age male education time

rename serialno origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename care_whole care

gen study_id = "gb2005-BES-N"

nearmrg using "gb2005_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "gb2005_bes_national_merge_F.dta", replace

* BES 2005 - DISTRICT

use "gb2005_bes.dta", clear

keep serialno correct_district_d discussion discussion_3pts disagreement disagreement_3pts pidscale_district interest knowledge care_whole age male education time enep margin district_code

rename serialno origid
rename correct_district_d forecast
rename pidscale_district wishful

gen study_id = "gb2005-BES-D"

save "gb2005_bes_district_merge_F.dta", replace

* BES 2010 - NATIONAL

use "gb2010_bes.dta", clear

keep cserial correct_whole_d discussion discussion_3pts disagreement disagreement_3pts pidscale_whole interest news knowledge care_whole age male education time

rename cserial origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename care_whole care

gen study_id = "gb2010-BES-N"

nearmrg using "gb2010_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "gb2010_bes_national_merge_F.dta", replace

* BES 2010 - DISTRICT

use "gb2010_bes.dta", clear

keep cserial correct_district_d discussion discussion_3pts disagreement disagreement_3pts pidscale_district interest news knowledge age male education time enep margin district_code

rename cserial origid
rename correct_district_d forecast
rename pidscale_district wishful

gen study_id = "gb2010-BES-D"

save "gb2010_bes_district_merge_F.dta", replace

* BES 2015 - DISTRICT

use "gb2015_2019_bes.dta", clear

keep id GB15_correct_districtW4W5_d GB15_discussionW4W5 GB15_discussionW4W5_3pts GB15_pidscale_districtW4W5 GB15_interestW4W5 GB15_newsW4W5 male GB15_ageW4W5 GB15_educationW4W5 GB15_timeW4W5 GB15_enepW4W5 GB15_marginW4W5 GB15_reelectedW4W5 wave4_5 districtW4W5

rename id origid
rename GB15_correct_districtW4W5_d forecast
rename GB15_discussionW4W5 discussion
rename GB15_discussionW4W5_3pts discussion_3pts
rename GB15_pidscale_districtW4W5 wishful
rename GB15_interestW4W5 interest
rename GB15_newsW4W5 news
rename GB15_ageW4W5 age
rename GB15_educationW4W5 education
rename GB15_timeW4W5 time
rename GB15_enepW4W5 enep
rename GB15_marginW4W5 margin
rename GB15_reelectedW4W5 reelected
rename districtW4W5 district_code

gen study_id = "gb2015-BES-D"

save "gb2015_bes_merge_F.dta", replace

* BES 2017 - DISTRICT

use "gb2015_2019_bes.dta", clear

keep id GB17_correct_districtW11W12_d GB17_discussionW11W12 GB17_discussionW11W12_3pts GB17_disagreementW11W12 GB17_disagreementW11W12_3pts GB17_pidscale_districtW11W12 GB17_interestW11W12 GB17_newsW11W12 GB17_knowledgeW11W12 male GB17_ageW11W12 GB17_educationW11W12 GB17_timeW11W12 GB17_enepW11W12 GB17_marginW11W12 GB17_reelectedW11W12 wave11_12 districtW11W12

rename id origid
rename GB17_correct_districtW11W12_d forecast
rename GB17_discussionW11W12 discussion
rename GB17_discussionW11W12_3pts discussion_3pts
rename GB17_disagreementW11W12 disagreement
rename GB17_disagreementW11W12_3pts disagreement_3pts
rename GB17_pidscale_districtW11W12 wishful
rename GB17_interestW11W12 interest
rename GB17_newsW11W12 news
rename GB17_knowledgeW11W12 knowledge
rename GB17_ageW11W12 age
rename GB17_educationW11W12 education
rename GB17_timeW11W12 time
rename GB17_enepW11W12 enep
rename GB17_marginW11W12 margin
rename GB17_reelectedW11W12 reelected
rename districtW11W12 district_code

gen study_id = "gb2017-BES-D"

save "gb2017_bes_merge_F.dta", replace

* BES 2019 - DISTRICT

use "gb2015_2019_bes.dta", clear

keep id GB19_correct_districtW17W18_d GB19_discussionW17W18 GB19_discussionW17W18_3pts GB19_disagreementW17W18 GB19_disagreementW17W18_3pts GB19_pidscale_districtW17W18 GB19_interestW17W18 GB19_newsW17W18 male GB19_ageW17W18 GB19_educationW17W18 GB19_timeW17W18 GB19_enepW17W18 GB19_marginW17W18 GB19_reelectedW17W18 wave17_18 districtW17W18

rename id origid
rename GB19_correct_districtW17W18_d forecast
rename GB19_discussionW17W18 discussion
rename GB19_discussionW17W18_3pts discussion_3pts
rename GB19_disagreementW17W18 disagreement
rename GB19_disagreementW17W18_3pts disagreement_3pts
rename GB19_pidscale_districtW17W18 wishful
rename GB19_interestW17W18 interest
rename GB19_newsW17W18 news
rename GB19_ageW17W18 age
rename GB19_educationW17W18 education
rename GB19_timeW17W18 time
rename GB19_enepW17W18 enep
rename GB19_marginW17W18 margin
rename GB19_reelectedW17W18 reelected
rename districtW17W18 district_code

gen study_id = "gb2019-BES-D"

save "gb2019_bes_merge_F.dta", replace

* HE-GLES 2013 - REGIONAL

use "he2013_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts expertise coalscale interest age male education time 

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "he2013-GLES-R"

nearmrg using "he2013_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "he2013_gles_merge_F.dta", replace

* INES 1992 - NATIONAL

use "il1992_ines.dta", clear

keep a1 correct_whole_d discussion discussion_3pts govpref news age male education time

rename a1 origid
rename correct_whole_d forecast
rename govpref wishful

gen study_id = "il1992-INES-N"

save "il1992_ines_merge_F.dta", replace

* INES 1996 - NATIONAL #1

use "il1996_ines.dta", clear

keep correct_largest discussion discussion_3pts disagreement disagreement_3pts partyvote age male education time

rename correct_largest forecast
rename partyvote wishful

gen study_id = "il1996-INES-N1"

save "il1996_ines_largest_merge_F.dta", replace

* INES 1996 - NATIONAL #2

use "il1996_ines.dta", clear

keep correct_pm discussion discussion_3pts disagreement disagreement_3pts pmvote age male education time

rename correct_pm forecast
rename pmvote wishful

gen study_id = "il1996-INES-N2"

save "il1996_ines_pm_merge_F.dta", replace

* INES 2003 - NATIONAL

use "il2003_ines.dta", clear

keep id1 correct_whole_d discussion discussion_3pts coalscale age male education time

rename id1 origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "il2003-INES-N"

save "il2003_ines_merge_F.dta", replace

* INES 2009 - NATIONAL

use "il2009_ines.dta", clear

keep mergenumber correct_whole_d discussion discussion_3pts pmvote news knowledge carepm age male education time

rename mergenumber origid
rename correct_whole_d forecast
rename pmvote wishful
rename carepm care

gen study_id = "il2009-INES-N"

nearmrg using "il2009_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "il2009_ines_merge_F.dta", replace

* INES 2015 - NATIONAL

use "il2015_ines.dta", clear

keep ID correct_whole_d discussion discussion_3pts coalpref news knowledge age male education time

rename ID origid
rename correct_whole_d forecast
rename coalpref wishful

gen study_id = "il2015-INES-N"

nearmrg using "il2015_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "il2015_ines_merge_F.dta", replace

* INES 2020 - NATIONAL

use "il2020_ines.dta", clear

keep id correct_whole_d discussion discussion_3pts coalpref news knowledge age male education time

rename id origid
rename correct_whole_d forecast
rename coalpref wishful

gen study_id = "il2020-INES-N"

nearmrg using "il2020_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "il2020_ines_merge_F.dta", replace

* INES 2021 - NATIONAL

use "il2021_ines.dta", clear

keep resp_id correct_whole_d discussion discussion_3pts coalpref news knowledge age male education time

rename resp_id origid
rename correct_whole_d forecast
rename coalpref wishful

gen study_id = "il2021-INES-N"

nearmrg using "il2021_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "il2021_ines_merge_F.dta", replace

* ITANES 2006 - NATIONAL

use "it2006_itanes.dta", clear

keep intnr correct_whole_d discussion discussion_3pts disagreement disagreement_3pts coalscale interest news knowledge age male education time

rename intnr origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "it2006-ITANES-N"

nearmrg using "it2006_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "it2006_itanes_merge_F.dta", replace

* MV-GLES 2016 - REGIONAL

use "mv2016_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts expertise coalscale interest age male education time  

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "mv2016-GLES-R"

nearmrg using "mv2016_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "mv2016_gles_merge_F.dta", replace

* NI-GLES 2013 - REGIONAL

use "ni2013_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts expertise coalscale interest age male education time

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "ni2013-GLES-R"

nearmrg using "ni2013_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "ni2013_gles_merge_F.dta", replace

* NW-GLES 2012 - REGIONAL

use "nw2012_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts expertise coalscale interest age male education time 

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "nw2012-GLES-R"

nearmrg using "nw2012_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "nw2012_gles_merge_F.dta", replace

* NW-GLES 2017 - REGIONAL

use "nw2017_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts expertise coalscale interest age male education time  

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "nw2017-GLES-R"

nearmrg using "nw2017_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "nw2017_gles_merge_F.dta", replace

* NZES 2002 - NATIONAL

use "nz2002_nzes.dta", clear

keep qucam02 correct_whole_d discussion pidscale_whole interest news knowledge age male education time

rename qucam02 origid
rename correct_whole_d forecast
rename pidscale_whole wishful

gen study_id = "nz2002-NZES-N"

nearmrg using "nz2002_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "nz2002_nzes_national_merge_F.dta", replace

* NZES 2002 - DISTRICT

use "nz2002_nzes.dta", clear

keep qucam02 correct_district_d discussion pidscale_district interest news knowledge age male education time enep margin district

rename qucam02 origid
rename correct_district_d forecast
rename pidscale_district wishful
rename district district_code

gen study_id = "nz2002-NZES-D"

save "nz2002_nzes_district_merge_F.dta", replace

* ON-Ipsos 2011 - REGIONAL

use "on2011_ipsos.dta", clear

keep respid correct_whole_d discussion discussion_3pts vote_whole age male education time

rename respid origid
rename correct_whole_d forecast
rename vote_whole wishful

gen study_id = "on2011-Ipsos-R"

nearmrg using "on2011_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "on2011_ipsos_provincial_merge_F.dta", replace

* ON-Ipsos 2011 - DISTRICT

use "on2011_ipsos.dta", clear

keep respid correct_district_d discussion discussion_3pts vote_district age male education enep margin reelected time district_code 

rename respid origid
rename correct_district_d forecast
rename vote_district wishful

gen study_id = "on2011-Ipsos-D"

save "on2011_ipsos_district_merge_F.dta", replace

* ON-Ipsos 2014 - REGIONAL

use "on2014_ipsos.dta", clear

keep respondent_id correct_whole_d discussion discussion_3pts vote_whole age male education time

rename respondent_id origid
rename correct_whole_d forecast
rename vote_whole wishful

gen study_id = "on2014-Ipsos-R"

nearmrg using "on2014_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "on2014_ipsos_provincial_merge_F.dta", replace

* ON-Ipsos 2014 - DISTRICT

use "on2014_ipsos.dta", clear

keep respondent_id correct_district_d discussion discussion_3pts vote_district age male education enep margin reelected time riding 

rename respondent_id origid
rename correct_district_d forecast
rename vote_district wishful
rename riding district_code

gen study_id = "on2014-Ipsos-D"

save "on2014_ipsos_district_merge_F.dta", replace

* ON-OES 2003 - REGIONAL

use "on2003_oes.dta", clear

keep id correct_whole_d discussion discussion_3pts pidscale_whole interest care news male age education time

rename id origid
rename correct_whole_d forecast
rename pidscale_whole wishful

gen study_id = "on2003-OES-R"

save "on2003_oes_provincial_merge_F.dta", replace

* ON-OES 2003 - DISTRICT

use "on2003_oes.dta", clear

keep id correct_district_d discussion discussion_3pts pidscale_district interest news male age education time reelected enep margin district_code

rename id origid
rename correct_district_d forecast
rename pidscale_district wishful

gen study_id = "on2003-OES-D"

save "on2003_oes_district_merge_F.dta", replace

* ON-OES 2007 - REGIONAL

use "on2007_OES.dta", clear

keep IDNUM correct_whole_d discussion pidstatus_whole interest news knowledge closeness_whole male age education time

rename IDNUM origid
rename correct_whole_d forecast
rename pidstatus_whole wishful
rename closeness_whole closeness

gen study_id = "on2007-OES-R"

nearmrg using "on2007_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "on2007_oes_provincial_merge_F.dta", replace

* PVS 2009 - NATIONAL #1

use "pt2009_pvs.dta", clear

keep id correct_morevotes_d discussion pidscale_whole interest news age male education time

rename id origid
rename correct_morevotes_d forecast
rename pidscale_whole wishful

gen study_id = "pt2009-PVS-N1"

nearmrg using "pt2009_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "pt2009_pvs_morevotes_merge_F.dta", replace

* PVS 2009 - NATIONAL #2

use "pt2009_pvs.dta", clear

keep id correct_majority_d discussion pidscale_whole interest news age male education time

rename id origid
rename correct_majority_d forecast
rename pidscale_whole wishful

gen study_id = "pt2009-PVS-N2"

nearmrg using "pt2009_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "pt2009_pvs_majority_merge_F.dta", replace

* RP-GLES 2016 - REGIONAL

use "rp2016_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts expertise coalscale interest age male education time  

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "rp2016-GLES-R"

nearmrg using "rp2016_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "rp2016_gles_merge_F.dta", replace

* SH-GLES 2017 - REGIONAL

use "sh2017_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts expertise coalscale interest age male education time 

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "sh2017-GLES-R"

nearmrg using "sh2017_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "sh2017_gles_merge_F.dta", replace

* SN-GLES 2014 - REGIONAL

use "sn2014_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts expertise coalscale interest age male education time 

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "sn2014-GLES-R"

nearmrg using "sn2014_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "sn2014_gles_merge_F.dta", replace

* TH-GLES 2014 - REGIONAL

use "th2014_gles.dta", clear

keep lfdn correct_whole_d discussion discussion_3pts disagreement disagreement_3pts size size_3pts expertise coalscale interest age male education time  

rename lfdn origid
rename correct_whole_d forecast
rename coalscale wishful

gen study_id = "th2014-GLES-R"

nearmrg using "th2014_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "th2014_gles_merge_F.dta", replace

* ANES 1984 - NATIONAL

use "us1984_anes.dta", clear

keep V840004 correct_whole_d discussion discussion_3pts pidscale_whole interest news care_whole closeness_whole age male education time 

rename V840004 origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename care_whole care
rename closeness_whole closeness

gen study_id = "us1984-ANES-N"

nearmrg using "us1984_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us1984_anes_national_merge_F.dta", replace

* ANES 1984 - STATE

use "us1984_anes.dta", clear

keep V840004 correct_state_d discussion discussion_3pts pidscale_state interest news closeness_state age male education time margin V840011

rename V840004 origid
rename correct_state_d forecast
rename pidscale_state wishful
rename closeness_state closeness
rename V840011 state

gen study_id = "us1984-ANES-S"

save "us1984_anes_state_merge_F.dta", replace

* ANES 1988 - NATIONAL

use "us1988_anes.dta", clear

keep V880004 correct_whole_d discussion discussion_3pts pidscale_whole interest news knowledge care_whole closeness_whole age male education time

rename V880004 origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename care_whole care
rename closeness_whole closeness

gen study_id = "us1988-ANES-N"

nearmrg using "us1988_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us1988_anes_national_merge_F.dta", replace

* ANES 1988 - STATE

use "us1988_anes.dta", clear

keep V880004 correct_state_d discussion discussion_3pts pidscale_state interest news knowledge closeness_state age male education time margin V880010

rename V880004 origid
rename correct_state_d forecast
rename pidscale_state wishful
rename closeness_state closeness
rename V880010 state

gen study_id = "us1988-ANES-S"

save "us1988_anes_state_merge_F.dta", replace

* ANES 1992 - NATIONAL

use "us1992_anes.dta", clear

keep V923004 correct_whole_d discussion discussion_3pts pidscale_whole interest news knowledge care_whole closeness_whole age male education time

rename V923004 origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename care_whole care
rename closeness_whole closeness

gen study_id = "us1992-ANES-N"

nearmrg using "us1992_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us1992_anes_national_merge_F.dta", replace

* ANES 1992 - STATE

use "us1992_anes.dta", clear

keep V923004 correct_state_d discussion discussion_3pts pidscale_state interest news knowledge closeness_state age male education time margin V900010

rename V923004 origid
rename correct_state_d forecast
rename pidscale_state wishful
rename closeness_state closeness
rename V900010 state

gen study_id = "us1992-ANES-S"

save "us1992_anes_state_merge_F.dta", replace

* ANES 1996 - NATIONAL

use "us1996_anes.dta", clear

keep V960001 correct_whole_d discussion discussion_3pts pidscale_whole interest news knowledge care_whole closeness_whole age male education time

rename V960001 origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename care_whole care
rename closeness_whole closeness

gen study_id = "us1996-ANES-N"

nearmrg using "us1996_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us1996_anes_national_merge_F.dta", replace

* ANES 1996 - STATE

use "us1996_anes.dta", clear

keep V960001 correct_state_d discussion discussion_3pts pidscale_state interest news knowledge closeness_state age male education time margin V967000B

rename V960001 origid
rename correct_state_d forecast
rename pidscale_state wishful
rename closeness_state closeness
rename V967000B state

gen study_id = "us1996-ANES-S"

save "us1996_anes_state_merge_F.dta", replace

* ANES 2000 - NATIONAL (PRESIDENT)

use "us2000_anes.dta", clear

keep V000001 correct_whole_d discussion discussion_3pts pidscale_whole interest news knowledge care_whole closeness_whole age male education time

rename V000001 origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename care_whole care
rename closeness_whole closeness

gen study_id = "us2000-ANES-N"

nearmrg using "us2000_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2000_anes_national_merge_F.dta", replace

* ANES 2000 - NATIONAL (HOUSE)

use "us2000_anes.dta", clear

keep V000001 correct_house_d discussion discussion_3pts pidscale_whole interest news knowledge care_house age male education time

rename V000001 origid
rename correct_house_d forecast
rename pidscale_whole wishful
rename care_house care

gen study_id = "us2000-ANES-USH"

nearmrg using "us2000H_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2000_anes_house_merge_F.dta", replace

* ANES 2000 - NATIONAL (SENATE)

use "us2000_anes.dta", clear

keep V000001 correct_senate_d discussion discussion_3pts pidscale_whole interest news knowledge age male education time

rename V000001 origid
rename correct_senate_d forecast
rename pidscale_whole wishful

gen study_id = "us2000-ANES-USS"

save "us2000_anes_senate_merge_F.dta", replace

* ANES 2004 - NATIONAL

use "us2004_anes.dta", clear

keep V040001 correct_whole_d discussion discussion_3pts pidscale_whole interest news knowledge care_whole closeness_whole age male education time

rename V040001 origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename care_whole care
rename closeness_whole closeness

gen study_id = "us2004-ANES-N"

nearmrg using "us2004_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2004_anes_national_merge_F.dta", replace

* ANES 2004 - STATE

use "us2004_anes.dta", clear

keep V040001 correct_state_d discussion discussion_3pts pidscale_state interest news knowledge closeness_state age male education time margin V041202

rename V040001 origid
rename correct_state_d forecast
rename pidscale_state wishful
rename closeness_state closeness
rename V041202 state

gen study_id = "us2004-ANES-S"

save "us2004_anes_state_merge_F.dta", replace

* ANES 2008 - NATIONAL

use "us2008_anes.dta", clear

keep V080001 correct_whole_d discussion discussion_3pts pidscale_whole interest news knowledge care_whole closeness_whole age male education time

rename V080001 origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename care_whole care
rename closeness_whole closeness

gen study_id = "us2008-ANES-N"

nearmrg using "us2008_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2008_anes_national_merge_F.dta", replace

* ANES 2008 - STATE

use "us2008_anes.dta", clear

keep V080001 correct_state_d discussion discussion_3pts pidscale_state interest news knowledge closeness_state age male education time margin V081201b

rename V080001 origid
rename correct_state_d forecast
rename pidscale_state wishful
rename closeness_state closeness
rename V081201b state

gen study_id = "us2008-ANES-S"

save "us2008_anes_state_merge_F.dta", replace

* ANES 2012 - NATIONAL

use "us2012_anes.dta", clear

keep caseid correct_whole_d discussion discussion_3pts pidscale_whole interest news knowledge care_whole closeness_whole age male education time

rename caseid origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename care_whole care
rename closeness_whole closeness

gen study_id = "us2012-ANES-N"

nearmrg using "us2012_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2012_anes_national_merge_F.dta", replace

* ANES 2012 - STATE

use "us2012_anes.dta", clear

keep caseid correct_state_d discussion discussion_3pts pidscale_state interest news knowledge closeness_state age male education time margin sample_stfips

rename caseid origid
rename correct_state_d forecast
rename pidscale_state wishful
rename closeness_state closeness
rename sample_stfips state

gen study_id = "us2012-ANES-S"

save "us2012_anes_state_merge_F.dta", replace

* ANES 2016 - NATIONAL

use "us2016_anes.dta", clear

keep V160001 correct_whole_d discussion discussion_3pts pidscale_whole interest news knowledge care_whole closeness_whole age male education time

rename V160001 origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename care_whole care
rename closeness_whole closeness

gen study_id = "us2016-ANES-N"

nearmrg using "us2016_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2016_anes_national_merge_F.dta", replace

* ANES 2016 - STATE

use "us2016_anes.dta", clear

keep V160001 correct_state_d discussion discussion_3pts pidscale_state interest news knowledge closeness_state age male education time margin V163001a

rename V160001 origid
rename correct_state_d forecast
rename pidscale_state wishful
rename closeness_state closeness
rename V163001a state

gen study_id = "us2016-ANES-S"

save "us2016_anes_state_merge_F.dta", replace

* ANES 2020 - NATIONAL

use "us2020_anes.dta", clear

keep V200001 correct_whole_d discussion discussion_3pts pidscale_whole interest news knowledge care_whole closeness_whole age male education time

rename V200001 origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename care_whole care
rename closeness_whole closeness

gen study_id = "us2020-ANES-N"

nearmrg using "us2020_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2020_anes_national_merge_F.dta", replace

* ANES 2020 - STATE

use "us2020_anes.dta", clear

keep V200001 correct_state_d discussion discussion_3pts pidscale_state interest news knowledge closeness_state age male education time margin V203000

rename V200001 origid
rename correct_state_d forecast
rename pidscale_state wishful
rename closeness_state closeness
rename V203000 state

gen study_id = "us2020-ANES-S"

save "us2020_anes_state_merge_F.dta", replace

* NAES 2000 - REPUBLICAN PRIMARIES

use "us2000_naes.dta", clear

keep ckey correct_repprimaries_d discussion discussion_3pts disagreement disagreement_3pts bushrating reppreference interest_primaries news primattention age male education rtime

rename ckey origid
rename correct_repprimaries_d forecast
rename bushrating wishful
rename interest_primaries interest
rename rtime time

gen study_id = "us2000-NAES-REP-P"

save "us2000_naes_repprimaries_merge_F.dta", replace

* NAES 2000 - DEMOCRATIC PRIMARIES

use "us2000_naes.dta", clear

keep ckey correct_demprimaries_d discussion discussion_3pts disagreement disagreement_3pts gorerating dempreference interest_primaries news primattention age male education dtime

rename ckey origid
rename correct_demprimaries_d forecast
rename gorerating wishful
rename interest_primaries interest
rename dtime time

gen study_id = "us2000-NAES-DEM-P"

save "us2000_naes_demprimaries_merge_F.dta", replace

* NAES 2000 - NATIONAL

use "us2000_naes.dta", clear

keep ckey correct_whole_d discussion discussion_3pts disagreement disagreement_3pts pidscale_whole interest_president news care_whole age male education time

rename ckey origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename interest_president interest
rename care_whole care

gen study_id = "us2000-NAES-N"

nearmrg using "us2000_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2000_naes_national_merge_F.dta", replace

* NAES 2004 - DEMOCRATIC PRIMARIES

use "us2004_naes.dta", clear

keep ckey correct_demprimaries_d discussion discussion_3pts kerryrating dempreference interest_primaries news age male education dtime

rename ckey origid
rename correct_demprimaries_d forecast
rename kerryrating wishful
rename interest_primaries interest
rename dtime time

gen study_id = "us2004-NAES-DEM-P"

save "us2004_naes_demprimaries_merge_F.dta", replace

* NAES 2004 - NATIONAL

use "us2004_naes.dta", clear

keep ckey correct_whole_d discussion discussion_3pts pidscale_whole interest_president news age male education time

rename ckey origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename interest_president interest

gen study_id = "us2004-NAES-N"

nearmrg using "us2004_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2004_naes_national_merge_F.dta", replace

* NAES 2008 - REPUBLICAN PRIMARIES

use "us2008_naes.dta", clear

keep rkey correct_repprimaries_d discussion discussion_3pts mccainrating reppreference interest news age male education rtime

rename rkey origid
rename correct_repprimaries_d forecast
rename mccainrating wishful
rename rtime time

gen study_id = "us2008-NAES-REP-P"

nearmrg using "repprim2008_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2008_naes_repprimaries_merge_F.dta", replace

* NAES 2008 - DEMOCRATIC PRIMARIES

use "us2008_naes.dta", clear

keep rkey correct_demprimaries_d discussion discussion_3pts disagreement disagreement_3pts obamarating dempreference interest news age male education dtime

rename rkey origid
rename correct_demprimaries_d forecast
rename obamarating wishful
rename dtime time

gen study_id = "us2008-NAES-DEM-P"

nearmrg using "demprim2008_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2008_naes_demprimaries_merge_F.dta", replace

* NAES 2008 - NATIONAL

use "us2008_naes.dta", clear

keep rkey correct_whole_d discussion discussion_3pts disagreement disagreement_3pts pidscale_whole interest news age male education time

rename rkey origid
rename correct_whole_d forecast
rename pidscale_whole wishful

gen study_id = "us2008-NAES-N"

nearmrg using "us2008_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2008_naes_national_merge_F.dta", replace

* TAPS 2016 - NATIONAL

use "us2016_taps.dta", clear

keep wustlid correct_whole_d discussion_s57 discussion_s57_3pts size_s57 size_s57_3pts pidscale_whole interest news_s57 age male education time

rename wustlid origid
rename correct_whole_d forecast
rename pidscale_whole wishful
rename discussion_s57 discussion
rename discussion_s57_3pts discussion_3pts
rename size_s57 size
rename size_s57_3pts size_3pts
rename news_s57 news

gen study_id = "us2016-TAPS-N"

nearmrg using "us2016_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2016_taps_national_merge_F.dta", replace

* TAPS 2016 - DEMOCRATIC PRIMARIES

use "us2016_taps.dta", clear

keep wustlid correct_demprimaries_d discussion_s53 discussion_s53_3pts size_s53 size_s53_3pts demvote interest news_s51 age male education dtime

rename wustlid origid
rename correct_demprimaries_d forecast
rename demvote wishful
rename discussion_s53 discussion
rename discussion_s53_3pts discussion_3pts
rename size_s53 size
rename size_s53_3pts size_3pts
rename news_s51 news
rename dtime time

gen study_id = "us2016-TAPS-DEM-P"

nearmrg using "demprim2016_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2016_taps_demprimaries_merge_F.dta", replace

* TAPS 2016 - REPUBLICAN PRIMARIES

use "us2016_taps.dta", clear

keep wustlid correct_repprimaries_d discussion_s53 discussion_s53_3pts size_s53 size_s53_3pts repvote interest news_s51 age male education rtime

rename wustlid origid
rename correct_repprimaries_d forecast
rename repvote wishful
rename discussion_s53 discussion
rename discussion_s53_3pts discussion_3pts
rename size_s53 size
rename size_s53_3pts size_3pts
rename news_s51 news
rename rtime time

gen study_id = "us2016-TAPS-REP-P"

nearmrg using "repprim2016_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2016_taps_repprimaries_merge_F.dta", replace

* UAS 2016 - NATIONAL

use "us2016_uas.dta", clear

keep uasid correct_whole_d disagreement disagreement_3pts votestatus_whole age male education time

rename uasid origid
rename correct_whole_d forecast
rename votestatus_whole wishful

gen study_id = "us2016-UAS-N"

nearmrg using "us2016_polls.dta", lower nearvar(time)
drop _merge
drop if study_id == ""

save "us2016_uas_national_merge_F.dta", replace

* New file: merge_contact_networks

use "at2013_autnes_merge_F.dta", clear

append using at2017_autnes_merge_F bb2014_gles_merge_F bw2016_gles_merge_F by2013_gles_merge_F ca1988_ces_national_merge_F ca1988_ces_district_merge_F ca1993_ces_merge_F ca1997_ces_merge_F ca2000_ces_merge_F ca2004_ces_national_merge_F ca2004_ces_district_merge_F ca2006_ces_national_merge_F ca2006_ces_district_merge_F ca2008_ces_national_merge_F ca2008_ces_district_merge_F ca2011_ces_national_merge_F ca2011_ces_district_merge_F ca2019_ces_mostseats_merge_F ca2019_ces_majority_merge_F ca2019_ces_district_merge_F ca2011_ipsos_national_merge_F ca2011_ipsos_district_merge_F ca2015_ipsos_national_merge_F ca2015_ipsos_district_merge_F de2002_gfes_merge_F de2009_gles_national_merge_F de2009_gles_national_merge_F de2009_gles_district_merge_F de2013_gles_national_merge_F de2013_gles_district_merge_F de2017_gles_national_merge_F de2017_gles_district_merge_F de2021_gles_national_merge_F de2021_gles_district_merge_F es2016_cis_merge_F esA2019_cis_merge_F esN2019_cis_merge_F gb1964_bes_national_merge_F gb1964_bes_district_merge_F gb1987_bes_merge_F gb2005_bes_national_merge_F gb2005_bes_district_merge_F gb2010_bes_national_merge_F gb2010_bes_district_merge_F gb2015_bes_merge_F gb2017_bes_merge_F gb2019_bes_merge_F he2013_gles_merge_F il1992_ines_merge_F il1996_ines_largest_merge_F il1996_ines_pm_merge_F il2003_ines_merge_F il2009_ines_merge_F il2015_ines_merge_F il2020_ines_merge_F il2021_ines_merge_F it2006_itanes_merge_F mtl2017_cmes_merge_F mv2016_gles_merge_F ni2013_gles_merge_F nw2012_gles_merge_F nw2017_gles_merge_F nz2002_nzes_national_merge_F nz2002_nzes_district_merge_F on2003_oes_provincial_merge_F on2003_oes_district_merge_F on2007_oes_provincial_merge_F on2011_ipsos_provincial_merge_F on2011_ipsos_district_merge_F on2014_ipsos_provincial_merge_F on2014_ipsos_district_merge_F pt2009_pvs_morevotes_merge_F pt2009_pvs_majority_merge_F qc2017_cmes_merge_F rp2016_gles_merge_F sk2020_skpes_regional_merge_F sh2017_gles_merge_F sn2014_gles_merge_F th2014_gles_merge_F us1984_anes_national_merge_F us1984_anes_state_merge_F us1988_anes_national_merge_F us1988_anes_state_merge_F us1992_anes_national_merge_F us1992_anes_state_merge_F us1996_anes_national_merge_F us1996_anes_state_merge_F us2000_anes_national_merge_F us2000_anes_house_merge_F us2000_anes_senate_merge_F us2004_anes_national_merge_F us2004_anes_state_merge_F us2008_anes_national_merge_F us2008_anes_state_merge_F us2012_anes_national_merge_F us2012_anes_state_merge_F us2016_anes_national_merge_F us2016_anes_state_merge_F us2016_taps_national_merge_F us2016_taps_demprimaries_merge_F us2016_taps_repprimaries_merge_F us2020_anes_national_merge_F us2020_anes_state_merge_F us2000_naes_repprimaries_merge_F us2000_naes_demprimaries_merge_F us2000_naes_national_merge_F us2004_naes_demprimaries_merge_F us2004_naes_national_merge_F us2008_naes_repprimaries_merge_F us2008_naes_demprimaries_merge_F us2008_naes_national_merge_F us2016_uas_national_merge_F, force

* Create variable for type of election (country-level)

gen at_n = strpos(study_id, "AUTNES-N") > 0
gen ca_n = strpos(study_id, "CES-N") > 0 | strpos(study_id, "Ipsos-CA") > 0
gen ca_d = strpos(study_id, "CES-D") > 0
gen ca_r = strpos(study_id, "OES-R") > 0 | strpos(study_id, "Ipsos-ON") > 0 | strpos(study_id, "SKPES-R") > 0
gen ca_m = strpos(study_id, "CMES-M") > 0
gen de_n = strpos(study_id, "GLES-N") > 0 | strpos(study_id, "GFES-N") > 0
gen de_r = strpos(study_id, "GLES-R") > 0
gen gb_n = strpos(study_id, "BES-N") > 0
gen gb_d = strpos(study_id, "BES-D") > 0
gen il_n = strpos(study_id, "INES-N") > 0
gen nz_n = strpos(study_id, "NZES-N") > 0
gen nz_d = strpos(study_id, "NZES-D") > 0
gen it_n = strpos(study_id, "ITANES-N") > 0
gen pt_n = strpos(study_id, "PVS-N") > 0
gen es_n = strpos(study_id, "CIS-N") > 0
gen us_n = strpos(study_id, "ANES-N") > 0 | strpos(study_id, "NAES-N") > 0 | strpos(study_id, "TAPS-N") > 0 | strpos(study_id, "UAS-N") > 0
gen us_s = strpos(study_id, "ANES-S") > 0
gen us_p = strpos(study_id, "NAES-DEM-P") > 0 | strpos(study_id, "NAES-REP-P") > 0 | strpos(study_id, "TAPS-DEM-P") > 0 | strpos(study_id, "TAPS-REP-P") > 0

gen country_level = 1 if at_n == 1
replace country_level = 2 if ca_n == 1
replace country_level = 3 if ca_d == 1
replace country_level = 4 if ca_r == 1
replace country_level = 5 if ca_m == 1
replace country_level = 6 if de_n == 1
replace country_level = 7 if de_r == 1
replace country_level = 8 if gb_n == 1
replace country_level = 9 if gb_d == 1
replace country_level = 10 if il_n == 1
replace country_level = 11 if nz_n == 1
replace country_level = 12 if nz_d == 1
replace country_level = 13 if it_n == 1
replace country_level = 14 if pt_n == 1
replace country_level = 15 if es_n == 1
replace country_level = 16 if us_n == 1
replace country_level = 17 if us_s == 1
replace country_level = 18 if us_p == 1

label define country_level 1 "Austria, National" 2 "Canada, National" 3 "Canada, District" 4 "Canada, Regional" 5 "Canada, Municipal" 6 "Germany, National" 7 "Germany, Regional" 8 "Great Britain, National" 9 "Great Britain, District" 10 "Israel, National" 11 "New Zealand, National" 12 "New Zealand, District" 13 "Italy, National" 14 "Portugal, National" 15 "Spain, National" 16 "United States, National" 17 "United States, State" 18 "United States, Primaries"
label values country_level country_level

* Save merged dataset

save "merge_contact_networks_full.dta", replace

* Running regressions and saving estimates

logistic forecast discussion wishful interest news age i.male education time if study_id == "at2013-AUTNES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(at2013_autnes_parmest_national.dta, replace)

gen sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size wishful interest news age i.male education time if study_id == "at2017-AUTNES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(at2017_autnes_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement expertise size wishful interest age i.male education time if study_id == "bb2014-GLES-R"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(bb2014_gles_parmest_regional.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size expertise wishful interest age i.male education time if study_id == "bw2016-GLES-R"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(bw2016_gles_parmest_regional.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size expertise wishful interest age i.male education time if study_id == "by2013-GLES-R"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(by2013_gles_parmest_regional.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast i.discussion wishful interest news age i.male education time if study_id == "ca1988-CES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca1988_ces_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast i.discussion wishful interest news age i.male education time margin if study_id == "ca1988-CES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca1988_ces_parmest_district.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast i.discussion wishful interest news age i.male education time if study_id == "ca1993-CES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca1993_ces_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement wishful interest news knowledge age i.male education time if study_id == "ca1997-CES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca1997_ces_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news knowledge age i.male education time margin i.reelected if study_id == "ca2000-CES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2000_ces_parmest_district_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion size wishful interest news knowledge i.male age education time if ces_year == 2004 & study_id == "ca2004-CES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2004_ces_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion size wishful interest news knowledge i.male age education time margin if study_id == "ca2004-CES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2004_ces_parmest_district.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge i.male age education time if ces_year == 2006 & study_id == "ca2006-CES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2006_ces_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news knowledge i.male age education time margin if ces_year == 2006 & study_id == "ca2006-CES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2006_ces_parmest_district_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion size wishful interest news knowledge i.male age education time if ces_year == 2008 & study_id == "ca2008-CES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2008_ces_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion size wishful interest news knowledge i.male age education time margin if ces_year == 2008 & study_id == "ca2008-CES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2008_ces_parmest_district.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size wishful interest age i.male education time if study_id == "ca2011-CES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2011_ces_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion disagreement size wishful interest age i.male education time margin i.reelected if study_id == "ca2011-CES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2011_ces_parmest_district.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size wishful interest age i.male education if study_id == "ca2019-CES-N1"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2019_ces_parmest_mostseats.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size wishful interest age i.male education if study_id == "ca2019-CES-N2"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2019_ces_parmest_majority.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion disagreement size wishful interest age i.male education margin i.reelected if study_id == "ca2019-CES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2019_ces_parmest_district.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size wishful interest news education age i.male if study_id == "sk2020-SKPES-R"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(sk2020_skpes_parmest_provincial.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful age i.male education if study_id == "ca2011-Ipsos-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2011_ipsos_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion i.wishful age i.male education margin i.reelected if study_id == "ca2011-Ipsos-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2011_ipsos_parmest_district_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful age i.male education if study_id == "ca2015-Ipsos-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2015_ipsos_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion i.wishful age i.male education margin if study_id == "ca2015-Ipsos-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ca2015_ipsos_parmest_district_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest age i.male education time if study_id == "de2002-GFES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(de2002_gfes_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement expertise wishful interest care age i.male education time if study_id == "de2009-GLES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(de2009_gles_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion disagreement expertise wishful interest age i.male education time margin i.reelected if study_id == "de2009-GLES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(de2009_gles_parmest_district.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement expertise size wishful interest care knowledge age i.male education time if study_id == "de2013-GLES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(de2013_gles_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion disagreement expertise size wishful interest knowledge age i.male education time margin i.reelected if study_id == "de2013-GLES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(de2013_gles_parmest_district.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement expertise size wishful interest care knowledge age i.male education time if study_id == "de2017-GLES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(de2017_gles_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion disagreement expertise size wishful interest knowledge age i.male education time margin i.reelected if study_id == "de2017-GLES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(de2017_gles_parmest_district.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size wishful interest care age i.male education time if study_id == "de2021-GLES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(de2021_gles_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion disagreement size wishful interest age i.male education time margin i.reelected if study_id == "de2021-GLES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(de2021_gles_parmest_district.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful interest age i.male education time if study_id == "es2016-CIS-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(es2016_cis_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful interest age i.male education time if study_id == "esA2019-CIS-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(esA2019_cis_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful interest age i.male education time if study_id == "esN2019-CIS-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(esN2019_cis_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast i.discussion wishful interest news i.care age i.male education time if study_id == "gb1964-BES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(gb1964_bes_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast i.discussion wishful interest news age i.male education time margin i.reelected if study_id == "gb1964-BES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(gb1964_bes_parmest_district_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest age i.male time if study_id == "gb1987-BES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(gb1987_bes_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement wishful interest knowledge i.care age i.male education time if study_id == "gb2005-BES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(gb2005_bes_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion disagreement wishful interest knowledge age i.male education time margin if study_id == "gb2005-BES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(gb2005_bes_parmest_district_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement wishful interest news knowledge i.care age i.male education time if study_id == "gb2010-BES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(gb2010_bes_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion disagreement wishful interest news knowledge age i.male education time margin if study_id == "gb2010-BES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(gb2010_bes_parmest_district_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news i.male age education time margin i.reelected if wave4_5 == 1 & study_id == "gb2015-BES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(gb2015_bes_parmest_district_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion disagreement wishful interest news knowledge i.male age education time margin i.reelected if wave11_12 == 1 & study_id == "gb2017-BES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(gb2017_bes_parmest_district_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion disagreement wishful interest news i.male age education time margin i.reelected if wave17_18 == 1 & study_id == "gb2019-BES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(gb2019_bes_parmest_district_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size expertise wishful interest age i.male education time if study_id == "he2013-GLES-R"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(he2013_gles_parmest_regional.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful news age i.male education time if study_id == "il1992-INES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(il1992_ines_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement i.wishful age i.male education time if study_id == "il1996-INES-N1"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(il1996_ines_parmest_national_largest.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement i.wishful age i.male education time if study_id == "il1996-INES-N2"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(il1996_ines_parmest_national_pm.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful age i.male education time if study_id == "il2003-INES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(il2003_ines_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful news knowledge care age i.male education time if study_id == "il2009-INES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(il2009_ines_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful news knowledge age i.male education time if study_id == "il2015-INES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(il2015_ines_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful news knowledge age i.male education time if study_id == "il2020-INES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(il2020_ines_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful news knowledge age i.male education time if study_id == "il2021-INES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(il2021_ines_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement wishful interest news knowledge age i.male education time if study_id == "it2006-ITANES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(it2006_itanes_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest knowledge age i.male education time if study_id == "mtl2017-CMES-M" 

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(mtl2017_cmes_parmest_municipal.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size expertise wishful interest age i.male education time if study_id == "mv2016-GLES-R" 

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(mv2016_gles_parmest_regional.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement expertise wishful interest age i.male education time if study_id == "ni2013-GLES-R" 

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(ni2013_gles_parmest_regional.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement expertise wishful interest age i.male education time if study_id == "nw2012-GLES-R"  

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(nw2012_gles_parmest_regional.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size expertise wishful interest age i.male education time if study_id == "nw2017-GLES-R"  

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(nw2017_gles_parmest_regional.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge age i.male education time if study_id == "nz2002-NZES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(nz2002_nzes_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news knowledge age i.male education time margin if study_id == "nz2002-NZES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(nz2002_nzes_parmest_district.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest i.care news i.male age education time if study_id == "on2003-OES-R"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(on2003_oes_parmest_provincial.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news i.male age education time margin i.reelected if study_id == "on2003-OES-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(on2003_oes_parmest_district.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge i.closeness i.male age education time if study_id == "on2007-OES-R"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(on2007_oes_parmest_provincial.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful age i.male education if study_id == "on2011-Ipsos-R"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(on2011_ipsos_parmest_provincial_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion i.wishful age i.male education margin i.reelected if study_id == "on2011-Ipsos-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(on2011_ipsos_parmest_district_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful age i.male education if study_id == "on2014-Ipsos-R"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(on2014_ipsos_parmest_provincial_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion i.wishful age i.male education margin i.reelected if study_id == "on2014-Ipsos-D" || district_code: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(on2014_ipsos_parmest_district_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news age i.male education time if study_id == "pt2009-PVS-N1"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(pt2009_pvs_parmest_national_morevotes.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news age i.male education time if study_id == "pt2009-PVS-N2"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(pt2009_pvs_parmest_national_majority.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest knowledge age i.male education time if study_id == "qc2017-CMES-M" 

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(qc2017_cmes_parmest_municipal.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size expertise wishful interest age i.male education time if study_id == "rp2016-GLES-R"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(rp2016_gles_parmest_regional.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size expertise wishful interest age i.male education time if study_id == "sh2017-GLES-R" 

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(sh2017_gles_parmest_regional.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size expertise wishful interest age i.male education time if study_id == "sn2014-GLES-R"  

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(sn2014_gles_parmest_regional.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement size expertise wishful interest age i.male education time if study_id == "th2014-GLES-R"   

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(th2014_gles_parmest_regional.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news i.care i.closeness age i.male education time if study_id == "us1984-ANES-N"  

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us1984_anes_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news i.closeness age i.male education time margin if study_id == "us1984-ANES-S" || state: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us1984_anes_parmest_state.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge i.care i.closeness age i.male education time if study_id == "us1988-ANES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us1988_anes_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news knowledge i.closeness age i.male education time margin if study_id == "us1988-ANES-S" || state: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us1988_anes_parmest_state.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge i.care i.closeness age i.male education time if study_id == "us1992-ANES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us1992_anes_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news knowledge i.closeness age i.male education time margin if study_id == "us1992-ANES-S" || state: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us1992_anes_parmest_state.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge i.care i.closeness age i.male education time if study_id == "us1996-ANES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us1996_anes_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news knowledge i.closeness age i.male education time margin if study_id == "us1996-ANES-S" || state: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us1996_anes_parmest_state.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge i.care i.closeness age i.male education time if study_id == "us2000-ANES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2000_anes_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge care age i.male education time if study_id == "us2000-ANES-USH"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2000_anes_parmest_house.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge age i.male education time if study_id == "us2000-ANES-USS"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2000_anes_parmest_senate.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement wishful interest news i.primattention age i.male education time if study_id == "us2000-NAES-REP-P"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2000_naes_parmest_repprimaries_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement wishful interest news i.primattention age i.male education time if study_id == "us2000-NAES-DEM-P"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2000_naes_parmest_demprimaries_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement wishful interest news i.care age i.male education time if study_id == "us2000-NAES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2000_naes_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge i.care i.closeness age i.male education time if study_id == "us2004-ANES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2004_anes_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news knowledge i.closeness age i.male education time margin if study_id == "us2004-ANES-S" || state: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2004_anes_parmest_state.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news age i.male education time if time > 0 & study_id == "us2004-NAES-DEM-P"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2000_naes_parmest_demprimaries_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news age i.male education time if time > 0 & study_id == "us2004-NAES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2000_naes_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge i.care i.closeness age i.male education time if study_id == "us2008-ANES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2008_anes_parmest_national.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news knowledge i.closeness age i.male education time margin if study_id == "us2008-ANES-S" || state: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2008_anes_parmest_state.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news age i.male education time if study_id == "us2008-NAES-REP-P"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2008_naes_parmest_repprimaries_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement wishful interest news age i.male education time if study_id == "us2008-NAES-DEM-P"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2008_naes_parmest_demprimaries_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion disagreement wishful interest news age i.male education time if study_id == "us2008-NAES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2008_naes_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge i.care i.closeness age i.male education time if study_id == "us2012-ANES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2012_anes_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news knowledge i.closeness age i.male education time margin if study_id == "us2012-ANES-S" || state: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2012_anes_parmest_state_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge care i.closeness age i.male education time if study_id == "us2016-ANES-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2016_anes_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

melogit forecast discussion wishful interest news knowledge i.closeness age i.male education time margin if study_id == "us2016-ANES-S" || state: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2016_anes_parmest_state_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful size interest news age i.male education time if study_id == "us2016-TAPS-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2016_taps_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful size interest news age i.male education time if study_id == "us2016-TAPS-DEM-P"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2016_taps_parmest_demprimaries_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion i.wishful size interest news age i.male education time if study_id == "us2016-TAPS-REP-P"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2016_taps_parmest_repprimaries_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast disagreement wishful age i.male education time if study_id == "us2016-UAS-N"

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2016_uas_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

logistic forecast discussion wishful interest news knowledge care i.closeness age i.male education time if study_id == "us2020-ANES-N"
 
parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2020_anes_parmest_national_full.dta, replace)

replace sample = 1 if e(sample) == 1

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(merge_contact_networks_full.dta, replace)

melogit forecast discussion wishful interest news knowledge i.closeness age i.male education time margin if study_id == "us2020-ANES-S" || state: , or

parmest, format(estimate min95 max95 %8.2f p %8.1e) list(,) saving(us2020_anes_parmest_state_full.dta, replace)

replace sample = 1 if e(sample) == 1


***************************
** STUDY-LEVEL VARIABLES **
***************************

gen election = " "

replace election = "2013 Austrian legislative election" if study_id == "at2013-AUTNES-N"
replace election = "2017 Austrian legislative election" if study_id == "at2017-AUTNES-N"
replace election = "2016 Baden-Württemberg state election" if study_id == "bw2016-GLES-R"
replace election = "2013 Bavarian state election" if study_id == "by2013-GLES-R"
replace election = "2014 Brandenburg state election" if study_id == "bb2014-GLES-R"
replace election = "1988 Canadian federal election" if study_id == "ca1988-CES-N"
replace election = "1988 Canadian federal election" if study_id == "ca1988-CES-D"
replace election = "1993 Canadian federal election" if study_id == "ca1993-CES-N"
replace election = "1997 Canadian federal election" if study_id == "ca1997-CES-N"
replace election = "2000 Canadian federal election" if study_id == "ca2000-CES-D"
replace election = "2004 Canadian federal election" if study_id == "ca2004-CES-N"
replace election = "2004 Canadian federal election" if study_id == "ca2004-CES-D"
replace election = "2006 Canadian federal election" if study_id == "ca2006-CES-N"
replace election = "2006 Canadian federal election" if study_id == "ca2006-CES-D"
replace election = "2008 Canadian federal election" if study_id == "ca2008-CES-N"
replace election = "2008 Canadian federal election" if study_id == "ca2008-CES-D"
replace election = "2011 Canadian federal election" if study_id == "ca2011-CES-N"
replace election = "2011 Canadian federal election" if study_id == "ca2011-CES-D"
replace election = "2019 Canadian federal election" if study_id == "ca2019-CES-N1"
replace election = "2019 Canadian federal election" if study_id == "ca2019-CES-N2"
replace election = "2019 Canadian federal election" if study_id == "ca2019-CES-D"
replace election = "2011 Canadian federal election" if study_id == "ca2011-Ipsos-N"
replace election = "2011 Canadian federal election" if study_id == "ca2011-Ipsos-D"
replace election = "2015 Canadian federal election" if study_id == "ca2015-Ipsos-N"
replace election = "2015 Canadian federal election" if study_id == "ca2015-Ipsos-D"
replace election = "2002 German federal election" if study_id == "de2002-GFES-N"
replace election = "2009 German federal election" if study_id == "de2009-GLES-N"
replace election = "2009 German federal election" if study_id == "de2009-GLES-D"
replace election = "2013 German federal election" if study_id == "de2013-GLES-N"
replace election = "2013 German federal election" if study_id == "de2013-GLES-D"
replace election = "2017 German federal election" if study_id == "de2017-GLES-N"
replace election = "2017 German federal election" if study_id == "de2017-GLES-D"
replace election = "2021 German federal election" if study_id == "de2021-GLES-N"
replace election = "2021 German federal election" if study_id == "de2021-GLES-D"
replace election = "1964 British general election" if study_id == "gb1964-BES-N"
replace election = "1964 British general election" if study_id == "gb1964-BES-D"
replace election = "1987 British general election" if study_id == "gb1987-BES-N"
replace election = "2005 British general election" if study_id == "gb2005-BES-N"
replace election = "2005 British general election" if study_id == "gb2005-BES-D"
replace election = "2010 British general election" if study_id == "gb2010-BES-N"
replace election = "2010 British general election" if study_id == "gb2010-BES-D"
replace election = "2015 British general election" if study_id == "gb2015-BES-D"
replace election = "2017 British general election" if study_id == "gb2017-BES-D"
replace election = "2019 British general election" if study_id == "gb2019-BES-D"
replace election = "2013 Hessian state election" if study_id == "he2013-GLES-R"
replace election = "1992 Israeli legislative election" if study_id == "il1992-INES-N"
replace election = "1996 Israeli legislative (Knesset) election" if study_id == "il1996-INES-N1"
replace election = "1996 Israeli legislative (PM) election" if study_id == "il1996-INES-N2"
replace election = "2003 Israeli legislative election" if study_id == "il2003-INES-N"
replace election = "2009 Israeli legislative election" if study_id == "il2009-INES-N"
replace election = "2015 Israeli legislative election" if study_id == "il2015-INES-N"
replace election = "2020 Israeli legislative election" if study_id == "il2020-INES-N"
replace election = "2021 Israeli legislative election" if study_id == "il2021-INES-N"
replace election = "2006 Italian general election" if study_id == "it2006-ITANES-N"
replace election = "2013 Lower Saxony state election" if study_id == "ni2013-GLES-R"
replace election = "2017 Montreal municipal election" if study_id == "mtl2017-CMES-M"
replace election = "2016 Mecklenburg-Western Pomerania state election" if study_id == "mv2016-GLES-R"
replace election = "2002 New Zealand general election" if study_id == "nz2002-NZES-N"
replace election = "2002 New Zealand general election" if study_id == "nz2002-NZES-D"
replace election = "2012 North Rhine-Westphalia state election" if study_id == "nw2012-GLES-R"
replace election = "2017 North Rhine-Westphalia state election" if study_id == "nw2017-GLES-R"
replace election = "2003 Ontario general election" if study_id == "on2003-OES-R"
replace election = "2003 Ontario general election" if study_id == "on2003-OES-D"
replace election = "2007 Ontario general election" if study_id == "on2007-OES-R"
replace election = "2011 Ontario general election" if study_id == "on2011-Ipsos-R"
replace election = "2011 Ontario general election" if study_id == "on2011-Ipsos-D"
replace election = "2014 Ontario general election" if study_id == "on2014-Ipsos-R"
replace election = "2014 Ontario general election" if study_id == "on2014-Ipsos-D"
replace election = "2009 Portuguese legislative election" if study_id == "pt2009-PVS-N1"
replace election = "2009 Portuguese legislative election" if study_id == "pt2009-PVS-N2"
replace election = "2017 Quebec City municipal election" if study_id == "qc2017-CMES-M"
replace election = "2016 Rhineland-Palatinate state election" if study_id == "rp2016-GLES-R"
replace election = "2014 Saxony state election" if study_id == "sn2014-GLES-R"
replace election = "2017 Schleswig-Holstein state election" if study_id == "sh2017-GLES-R"
replace election = "2016 Spanish general election" if study_id == "es2016-CIS-N"
replace election = "April 2019 Spanish general election" if study_id == "esA2019-CIS-N"
replace election = "November 2019 Spanish general election" if study_id == "esN2019-CIS-N"
replace election = "2020 Saskatchewan general election" if study_id == "sk2020-SKPES-R"
replace election = "2014 Thuringian state election" if study_id == "th2014-GLES-R"
replace election = "1984 United States presidential election" if study_id == "us1984-ANES-N"
replace election = "1984 United States presidential election" if study_id == "us1984-ANES-S"
replace election = "1988 United States presidential election" if study_id == "us1988-ANES-N"
replace election = "1988 United States presidential election" if study_id == "us1988-ANES-S"
replace election = "1992 United States presidential election" if study_id == "us1992-ANES-N"
replace election = "1992 United States presidential election" if study_id == "us1992-ANES-S"
replace election = "1996 United States presidential election" if study_id == "us1996-ANES-N"
replace election = "1996 United States presidential election" if study_id == "us1996-ANES-S"
replace election = "2000 United States presidential election" if study_id == "us2000-ANES-N"
replace election = "2000 United States House of Representatives elections" if study_id == "us2000-ANES-USH"
replace election = "2000 United States Senate elections" if study_id == "us2000-ANES-USS"
replace election = "2000 American presidential election" if study_id == "us2000-NAES-N"
replace election = "2000 Republican Party presidential primaries" if study_id == "us2000-NAES-REP-P"
replace election = "2000 Democratic Party presidential primaries" if study_id == "us2000-NAES-DEM-P"
replace election = "2004 United States presidential election" if study_id == "us2004-ANES-N"
replace election = "2004 United States presidential election" if study_id == "us2004-ANES-S"
replace election = "2004 United States presidential election" if study_id == "us2004-NAES-N"
replace election = "2004 Democratic Party presidential primaries" if study_id == "us2004-NAES-DEM-P"
replace election = "2008 United States presidential election" if study_id == "us2008-ANES-N"
replace election = "2008 United States presidential election" if study_id == "us2008-ANES-S"
replace election = "2008 United States presidential election" if study_id == "us2008-NAES-N"
replace election = "2008 Republican Party presidential primaries" if study_id == "us2008-NAES-REP-P"
replace election = "2008 Democratic Party presidential primaries" if study_id == "us2008-NAES-DEM-P"
replace election = "2012 United States presidential election" if study_id == "us2012-ANES-N"
replace election = "2012 United States presidential election" if study_id == "us2012-ANES-S"
replace election = "2016 United States presidential election" if study_id == "us2016-ANES-N"
replace election = "2016 United States presidential election" if study_id == "us2016-ANES-S"
replace election = "2016 United States presidential election" if study_id == "us2016-TAPS-N"
replace election = "2016 United States presidential election" if study_id == "us2016-UAS-N"
replace election = "2016 Republican Party presidential primaries" if study_id == "us2016-TAPS-REP-P"
replace election = "2016 Democratic Party presidential primaries" if study_id == "us2016-TAPS-DEM-P"
replace election = "2020 United States presidential election" if study_id == "us2020-ANES-N"
replace election = "2020 United States presidential election" if study_id == "us2020-ANES-S"

gen study = " "

replace study = "Austrian National Election Study" if study_id == "at2013-AUTNES-N"
replace study = "Austrian National Election Study" if study_id == "at2017-AUTNES-N"
replace study = "German Longitudinal Election Study" if study_id == "bw2016-GLES-R"
replace study = "German Longitudinal Election Study" if study_id == "by2013-GLES-R"
replace study = "German Longitudinal Election Study" if study_id == "bb2014-GLES-R"
replace study = "Canadian National Election Study" if study_id == "ca1988-CES-N"
replace study = "Canadian Election Study" if study_id == "ca1988-CES-D"
replace study = "Canadian Election Study" if study_id == "ca1993-CES-N"
replace study = "Canadian Election Study" if study_id == "ca1997-CES-N"
replace study = "Canadian Election Study" if study_id == "ca2000-CES-D"
replace study = "Canadian Election Study" if study_id == "ca2004-CES-N"
replace study = "Canadian Election Study" if study_id == "ca2004-CES-D"
replace study = "Canadian Election Study" if study_id == "ca2006-CES-N"
replace study = "Canadian Election Study" if study_id == "ca2006-CES-D"
replace study = "Canadian Election Study" if study_id == "ca2008-CES-N"
replace study = "Canadian Election Study" if study_id == "ca2008-CES-D"
replace study = "Canadian Election Study" if study_id == "ca2011-CES-N"
replace study = "Canadian Election Study" if study_id == "ca2011-CES-D"
replace study = "Canadian Election Study" if study_id == "ca2019-CES-N1"
replace study = "Canadian Election Study" if study_id == "ca2019-CES-N2"
replace study = "Canadian Election Study" if study_id == "ca2019-CES-D"
replace study = "Ipsos i-Say Panel" if study_id == "ca2011-Ipsos-N"
replace study = "Ipsos i-Say Panel" if study_id == "ca2011-Ipsos-D"
replace study = "Ipsos i-Say Panel" if study_id == "ca2015-Ipsos-N"
replace study = "Ipsos i-Say Panel" if study_id == "ca2015-Ipsos-D"
replace study = "German Federal Election Study" if study_id == "de2002-GFES-N"
replace study = "German Longitudinal Election Study" if study_id == "de2009-GLES-N"
replace study = "German Longitudinal Election Study" if study_id == "de2009-GLES-D"
replace study = "German Longitudinal Election Study" if study_id == "de2013-GLES-N"
replace study = "German Longitudinal Election Study" if study_id == "de2013-GLES-D"
replace study = "German Longitudinal Election Study" if study_id == "de2017-GLES-N"
replace study = "German Longitudinal Election Study" if study_id == "de2017-GLES-D"
replace study = "German Longitudinal Election Study" if study_id == "de2021-GLES-N"
replace study = "German Longitudinal Election Study" if study_id == "de2021-GLES-D"
replace study = "British Election Study" if study_id == "gb1964-BES-N"
replace study = "British Election Study" if study_id == "gb1964-BES-D"
replace study = "British Election Study" if study_id == "gb1987-BES-N"
replace study = "British Election Study" if study_id == "gb2005-BES-N"
replace study = "British Election Study" if study_id == "gb2005-BES-D"
replace study = "British Election Study" if study_id == "gb2010-BES-N"
replace study = "British Election Study" if study_id == "gb2010-BES-D"
replace study = "British Election Study" if study_id == "gb2015-BES-D"
replace study = "British Election Study" if study_id == "gb2017-BES-D"
replace study = "British Election Study" if study_id == "gb2019-BES-D"
replace study = "German Longitudinal Election Study" if study_id == "he2013-GLES-R"
replace study = "Israel National Election Study" if study_id == "il1992-INES-N"
replace study = "Israel National Election Study" if study_id == "il1996-INES-N1"
replace study = "Israel National Election Study" if study_id == "il1996-INES-N2"
replace study = "Israel National Election Study" if study_id == "il2003-INES-N"
replace study = "Israel National Election Study" if study_id == "il2009-INES-N"
replace study = "Israel National Election Study" if study_id == "il2015-INES-N"
replace study = "Israel National Election Study" if study_id == "il2020-INES-N"
replace study = "Israel National Election Study" if study_id == "il2021-INES-N"
replace study = "Italian National Election Study" if study_id == "it2006-ITANES-N"
replace study = "German Longitudinal Election Study" if study_id == "ni2013-GLES-R"
replace study = "Canadian Municipal Election Study" if study_id == "mtl2017-CMES-M"
replace study = "German Longitudinal Election Study" if study_id == "mv2016-GLES-R"
replace study = "New Zealand Election Study" if study_id == "nz2002-NZES-N"
replace study = "New Zealand Election Study" if study_id == "nz2002-NZES-D"
replace study = "German Longitudinal Election Study" if study_id == "nw2012-GLES-R"
replace study = "German Longitudinal Election Study" if study_id == "nw2017-GLES-R"
replace study = "Ontario Election Study" if study_id == "on2003-OES-R"
replace study = "Ontario Election Study" if study_id == "on2003-OES-D"
replace study = "Ontario Election Study" if study_id == "on2007-OES-R"
replace study = "Ipsos i-Say Panel" if study_id == "on2011-Ipsos-R"
replace study = "Ipsos i-Say Panel" if study_id == "on2011-Ipsos-D"
replace study = "Ipsos i-Say Panel" if study_id == "on2014-Ipsos-R"
replace study = "Ipsos i-Say Panel" if study_id == "on2014-Ipsos-D"
replace study = "Portuguese Voters Survey" if study_id == "pt2009-PVS-N1"
replace study = "Portuguese Voters Survey" if study_id == "pt2009-PVS-N2"
replace study = "Canadian Municipal Election Study" if study_id == "qc2017-CMES-M"
replace study = "German Longitudinal Election Study" if study_id == "rp2016-GLES-R"
replace study = "German Longitudinal Election Study" if study_id == "sn2014-GLES-R"
replace study = "German Longitudinal Election Study" if study_id == "sh2017-GLES-R"
replace study = "Spanish Election Survey" if study_id == "es2016-CIS-N"
replace study = "Spanish Election Survey" if study_id == "esA2019-CIS-N"
replace study = "Spanish Election Survey" if study_id == "esN2019-CIS-N"
replace study = "Saskatchewan Provincial Election Study" if study_id == "sk2020-SKPES-R"
replace study = "German Longitudinal Election Study" if study_id == "th2014-GLES-R"
replace study = "American National Election Study" if study_id == "us1984-ANES-N"
replace study = "American National Election Study" if study_id == "us1984-ANES-S"
replace study = "American National Election Study" if study_id == "us1988-ANES-N"
replace study = "American National Election Study" if study_id == "us1988-ANES-S"
replace study = "American National Election Study" if study_id == "us1992-ANES-N"
replace study = "American National Election Study" if study_id == "us1992-ANES-S"
replace study = "American National Election Study" if study_id == "us1996-ANES-N"
replace study = "American National Election Study" if study_id == "us1996-ANES-S"
replace study = "American National Election Study" if study_id == "us2000-ANES-N"
replace study = "American National Election Study" if study_id == "us2000-ANES-USH"
replace study = "American National Election Study" if study_id == "us2000-ANES-USS"
replace study = "National Annenberg Election Survey" if study_id == "us2000-NAES-N"
replace study = "National Annenberg Election Survey" if study_id == "us2000-NAES-REP-P"
replace study = "National Annenberg Election Survey" if study_id == "us2000-NAES-DEM-P"
replace study = "American National Election Study" if study_id == "us2004-ANES-N"
replace study = "American National Election Study" if study_id == "us2004-ANES-S"
replace study = "National Annenberg Election Survey" if study_id == "us2004-NAES-N"
replace study = "National Annenberg Election Survey" if study_id == "us2004-NAES-DEM-P"
replace study = "American National Election Study" if study_id == "us2008-ANES-N"
replace study = "American National Election Study" if study_id == "us2008-ANES-S"
replace study = "National Annenberg Election Survey" if study_id == "us2008-NAES-N"
replace study = "National Annenberg Election Survey" if study_id == "us2008-NAES-REP-P"
replace study = "National Annenberg Election Survey" if study_id == "us2008-NAES-DEM-P"
replace study = "American National Election Study" if study_id == "us2012-ANES-N"
replace study = "American National Election Study" if study_id == "us2012-ANES-S"
replace study = "American National Election Study" if study_id == "us2016-ANES-N"
replace study = "American National Election Study" if study_id == "us2016-ANES-S"
replace study = "American Panel Survey" if study_id == "us2016-TAPS-N"
replace study = "American Panel Survey" if study_id == "us2016-TAPS-REP-P"
replace study = "American Panel Survey" if study_id == "us2016-TAPS-DEM-P"
replace study = "Understanding American Study" if study_id == "us2016-UAS-N"
replace study = "American National Election Study" if study_id == "us2020-ANES-N"
replace study = "American National Election Study" if study_id == "us2020-ANES-S"

gen survey_name = " "

replace survey_name = "AUTNES Pre- and Post Panel Study 2013" if study_id == "at2013-AUTNES-N"
replace survey_name = "AUTNES Online Panel Study 2017" if study_id == "at2017-AUTNES-N"
replace survey_name = "Long-Term Online Tracking of the 2016 State Election in Baden-Württemberg (ZA5741)" if study_id == "bw2016-GLES-R"
replace survey_name = "Long-Term Online Tracking of the 2013 State Election in Bavaria (ZA5736)" if study_id == "by2013-GLES-R"
replace survey_name = "Long-Term Online Tracking of the 2014 State Election in Brandenburg (ZA5739)" if study_id == "bb2014-GLES-R"
replace survey_name = "1988 Canadian National Election Study" if study_id == "ca1988-CES-N"
replace survey_name = "1988 Canadian National Election Study" if study_id == "ca1988-CES-D"
replace survey_name = "1993 Canadian Election Study" if study_id == "ca1993-CES-N"
replace survey_name = "1997 Canadian Election Survey" if study_id == "ca1997-CES-N"
replace survey_name = "2000 Canadian Election Survey" if study_id == "ca2000-CES-D"
replace survey_name = "2004 Canadian Election Survey" if study_id == "ca2004-CES-N"
replace survey_name = "2004 Canadian Election Survey" if study_id == "ca2004-CES-D"
replace survey_name = "2006 Canadian Election Survey" if study_id == "ca2006-CES-N"
replace survey_name = "2006 Canadian Election Survey" if study_id == "ca2006-CES-D"
replace survey_name = "2008 Canadian Election Survey" if study_id == "ca2008-CES-N"
replace survey_name = "2008 Canadian Election Survey" if study_id == "ca2008-CES-D"
replace survey_name = "2011 Canadian Election Survey" if study_id == "ca2011-CES-N"
replace survey_name = "2011 Canadian Election Survey" if study_id == "ca2011-CES-D"
replace survey_name = "2019 Canadian Election Study" if study_id == "ca2019-CES-N1"
replace survey_name = "2019 Canadian Election Study" if study_id == "ca2019-CES-N2"
replace survey_name = "2019 Canadian Election Study" if study_id == "ca2019-CES-D"
replace survey_name = "2011 Canada General Election Exit Survey" if study_id == "ca2011-Ipsos-N"
replace survey_name = "2011 Canada General Election Exit Survey" if study_id == "ca2011-Ipsos-D"
replace survey_name = "2015 Canada General Election Exit Survey" if study_id == "ca2015-Ipsos-N"
replace survey_name = "2015 Canada General Election Exit Survey" if study_id == "ca2015-Ipsos-D"
replace survey_name = "2002 German Federal Election Study (ZA5320)" if study_id == "de2002-GFES-N"
replace survey_name = "GLES 2009 Pre- and Post-election Cross Section (ZA5302)" if study_id == "de2009-GLES-N"
replace survey_name = "GLES 2009 Pre- and Post-election Cross Section (ZA5302)" if study_id == "de2009-GLES-D"
replace survey_name = "GLES 2013 Pre- and Post-election Cross Section (ZA5702)" if study_id == "de2013-GLES-N"
replace survey_name = "GLES 2013 Pre- and Post-election Cross Section (ZA5702)" if study_id == "de2013-GLES-D"
replace survey_name = "GLES 2017 Pre- and Post-election Cross Section (ZA6802)" if study_id == "de2017-GLES-N"
replace survey_name = "GLES 2017 Pre- and Post-election Cross Section (ZA6802)" if study_id == "de2017-GLES-D"
replace survey_name = "GLES Cross-Section 2021, Pre-Election (ZA7701)" if study_id == "de2021-GLES-N"
replace survey_name = "GLES Cross-Section 2021, Pre-Election (ZA7701)" if study_id == "de2021-GLES-D"
replace survey_name = "Study of Political Change in Britain, 1963-1970" if study_id == "gb1964-BES-N"
replace survey_name = "Study of Political Change in Britain, 1963-1970" if study_id == "gb1964-BES-D"
replace survey_name = "1987 British Election Campaign Study" if study_id == "gb1987-BES-N"
replace survey_name = "2005 British Election Study" if study_id == "gb2005-BES-N"
replace survey_name = "2005 British Election Study" if study_id == "gb2005-BES-D"
replace survey_name = "2010 British Election Study" if study_id == "gb2010-BES-N"
replace survey_name = "2010 British Election Study" if study_id == "gb2010-BES-D"
replace survey_name = "BES Internet Panel Study Combined Wave 1-19 Internet Panel" if study_id == "gb2015-BES-D"
replace survey_name = "BES Internet Panel Study Combined Wave 1-19 Internet Panel" if study_id == "gb2017-BES-D"
replace survey_name = "BES Internet Panel Study Combined Wave 1-19 Internet Panel" if study_id == "gb2019-BES-D"
replace survey_name = "Long-Term Online Tracking of the 2013 State Election in Hesse (ZA5737)" if study_id == "he2013-GLES-R"
replace survey_name = "1992 Israel National Election Study" if study_id == "il1992-INES-N"
replace survey_name = "1996 Israel National Election Study" if study_id == "il1996-INES-N1"
replace survey_name = "1996 Israel National Election Study" if study_id == "il1996-INES-N2"
replace survey_name = "2003 Israel National Election Study" if study_id == "il2003-INES-N"
replace survey_name = "2009 Israel National Election Study" if study_id == "il2009-INES-N"
replace survey_name = "2015 Israel National Election Study" if study_id == "il2015-INES-N"
replace survey_name = "2020 Israel National Election Study" if study_id == "il2020-INES-N"
replace survey_name = "2021 Israel National Election Study" if study_id == "il2021-INES-N"
replace survey_name = "2006 Italian National Election Study" if study_id == "it2006-ITANES-N"
replace survey_name = "Long-Term Online Tracking of the 2013 State Election in Lower Saxony (ZA5735)" if study_id == "ni2013-GLES-R"
replace survey_name = "Canadian Municipal Election Study" if study_id == "mtl2017-CMES-M"
replace survey_name = "Long-Term Online Tracking of the 2016 State Election in Mecklenburg-Western Pomerania (ZA5744)" if study_id == "mv2016-GLES-R"
replace survey_name = "2002 New Zealand Election Study" if study_id == "nz2002-NZES-N"
replace survey_name = "2002 New Zealand Election Study" if study_id == "nz2002-NZES-D"
replace survey_name = "Long-Term Online Tracking of the 2012 State Election in North Rhine-Westphalia (ZA5333)" if study_id == "nw2012-GLES-R"
replace survey_name = "Long-Term Online Tracking of the 2017 State Election in North Rhine-Westphalia (ZA6820)" if study_id == "nw2017-GLES-R"
replace survey_name = "2003 Ontario Election Study" if study_id == "on2003-OES-R"
replace survey_name = "2003 Ontario Election Study" if study_id == "on2003-OES-D"
replace survey_name = "2007 Ontario Referendum and Election Study" if study_id == "on2007-OES-R"
replace survey_name = "2011 Ontario General Election Exit Survey" if study_id == "on2011-Ipsos-R"
replace survey_name = "2011 Ontario General Election Exit Survey" if study_id == "on2011-Ipsos-D"
replace survey_name = "2014 Ontario General Election Exit Survey" if study_id == "on2014-Ipsos-R"
replace survey_name = "2014 Ontario General Election Exit Survey" if study_id == "on2014-Ipsos-D"
replace survey_name = "2008 Portuguese Voters Survey" if study_id == "pt2009-PVS-N1"
replace survey_name = "2008 Portuguese Voters Survey" if study_id == "pt2009-PVS-N2"
replace survey_name = "Canadian Municipal Election Study" if study_id == "qc2017-CMES-M"
replace survey_name = "Long-Term Online Tracking of the 2016 State Election in Rhineland-Palatinate (ZA5743)" if study_id == "rp2016-GLES-R"
replace survey_name = "Long-Term Online Tracking of the 2014 State Election in Saxony (ZA5738)" if study_id == "sn2014-GLES-R"
replace survey_name = "Long-Term Online Tracking of the 2017 State Election in Schleswig-Holstein (ZA6819)" if study_id == "sh2017-GLES-R"
replace survey_name = "May 2016 Spanish Pre-Election Survey (3141) " if study_id == "es2016-CIS-N"
replace survey_name = "Mar. 2019 Spanish Pre-Election Survey (3242) " if study_id == "esA2019-CIS-N"
replace survey_name = "Sep.-Oct. 2019 Spanish Pre-Election Syrvey (3263)" if study_id == "esN2019-CIS-N"
replace survey_name = "2020 Saskatchewan Provincial Election Study" if study_id == "sk2020-SKPES-R"
replace survey_name = "Long-Term Online Tracking of the 2014 State Election in Thuringia (ZA5740)" if study_id == "th2014-GLES-R"
replace survey_name = "American National Election Study 1984 Time Series Study" if study_id == "us1984-ANES-N"
replace survey_name = "American National Election Study 1984 Time Series Study" if study_id == "us1984-ANES-S"
replace survey_name = "American National Election Study 1988 Time Series Study" if study_id == "us1988-ANES-N"
replace survey_name = "American National Election Study 1988 Time Series Study" if study_id == "us1988-ANES-S"
replace survey_name = "American National Election Study 1992 Time Series Study" if study_id == "us1992-ANES-N"
replace survey_name = "American National Election Study 1992 Time Series Study" if study_id == "us1992-ANES-S"
replace survey_name = "American National Election Study 1996 Time Series Study" if study_id == "us1996-ANES-N"
replace survey_name = "American National Election Study 1996 Time Series Study" if study_id == "us1996-ANES-S"
replace survey_name = "American National Election Study 2000 Time Series Study" if study_id == "us2000-ANES-N"
replace survey_name = "American National Election Study 2000 Time Series Study" if study_id == "us2000-ANES-USH"
replace survey_name = "American National Election Study 2000 Time Series Study" if study_id == "us2000-ANES-USS"
replace survey_name = "2000 National Annenberg Election Survey" if study_id == "us2000-NAES-N"
replace survey_name = "2000 National Annenberg Election Survey" if study_id == "us2000-NAES-REP-P"
replace survey_name = "2000 National Annenberg Election Survey" if study_id == "us2000-NAES-DEM-P"
replace survey_name = "American National Election Study 2004 Time Series Study" if study_id == "us2004-ANES-N"
replace survey_name = "American National Election Study 2004 Time Series Study" if study_id == "us2004-ANES-S"
replace survey_name = "2004 National Annenberg Election Survey" if study_id == "us2004-NAES-N"
replace survey_name = "2004 National Annenberg Election Survey" if study_id == "us2004-NAES-DEM-P"
replace survey_name = "American National Election Study 2008 Time Series Study" if study_id == "us2008-ANES-N"
replace survey_name = "American National Election Study 2008 Time Series Study" if study_id == "us2008-ANES-S"
replace survey_name = "2008 National Annenberg Election Survey Phone Edition" if study_id == "us2008-NAES-N"
replace survey_name = "2008 National Annenberg Election Survey Phone Edition" if study_id == "us2008-NAES-REP-P"
replace survey_name = "2008 National Annenberg Election Survey Phone Edition" if study_id == "us2008-NAES-DEM-P"
replace survey_name = "American National Election Study 2012 Time Series Study" if study_id == "us2012-ANES-N"
replace survey_name = "American National Election Study 2012 Time Series Study" if study_id == "us2012-ANES-S"
replace survey_name = "American National Election Study 2016 Time Series Study" if study_id == "us2016-ANES-N"
replace survey_name = "American National Election Study 2016 Time Series Study" if study_id == "us2016-ANES-S"
replace survey_name = "2016 American Panel Survey" if study_id == "us2016-TAPS-N"
replace survey_name = "2016 American Panel Survey" if study_id == "us2016-TAPS-REP-P"
replace survey_name = "2016 American Panel Survey" if study_id == "us2016-TAPS-DEM-P"
replace survey_name = "Understanding America Study - 2016 Election Survey" if study_id == "us2016-UAS-N"
replace survey_name = "American National Election Study 2020 Time Series Study" if study_id == "us2020-ANES-N"
replace survey_name = "American National Election Study 2020 Time Series Study" if study_id == "us2020-ANES-S"

gen survey_year = " "

replace survey_year = "2012-2013" if study_id == "at2013-AUTNES-N"
replace survey_year = "2017" if study_id == "at2017-AUTNES-N"
replace survey_year = "2016" if study_id == "bw2016-GLES-R"
replace survey_year = "2013" if study_id == "by2013-GLES-R"
replace survey_year = "2014" if study_id == "bb2014-GLES-R"
replace survey_year = "1988-1989" if study_id == "ca1988-CES-N"
replace survey_year = "1988-1989" if study_id == "ca1988-CES-D"
replace survey_year = "1993-1994" if study_id == "ca1993-CES-N"
replace survey_year = "1997" if study_id == "ca1997-CES-N"
replace survey_year = "2000-2001" if study_id == "ca2000-CES-D"
replace survey_year = "2004" if study_id == "ca2004-CES-N"
replace survey_year = "2004" if study_id == "ca2004-CES-D"
replace survey_year = "2005-2006" if study_id == "ca2006-CES-N"
replace survey_year = "2005-2006" if study_id == "ca2006-CES-D"
replace survey_year = "2008" if study_id == "ca2008-CES-N"
replace survey_year = "2008" if study_id == "ca2008-CES-D"
replace survey_year = "2011" if study_id == "ca2011-CES-N"
replace survey_year = "2011" if study_id == "ca2011-CES-D"
replace survey_year = "2019" if study_id == "ca2019-CES-N1"
replace survey_year = "2019" if study_id == "ca2019-CES-N2"
replace survey_year = "2019" if study_id == "ca2019-CES-D"
replace survey_year = "2011" if study_id == "ca2011-Ipsos-N"
replace survey_year = "2011" if study_id == "ca2011-Ipsos-D"
replace survey_year = "2015" if study_id == "ca2015-Ipsos-N"
replace survey_year = "2015" if study_id == "ca2015-Ipsos-D"
replace survey_year = "2002" if study_id == "de2002-GFES-N"
replace survey_year = "2009" if study_id == "de2009-GLES-N"
replace survey_year = "2009" if study_id == "de2009-GLES-D"
replace survey_year = "2013" if study_id == "de2013-GLES-N"
replace survey_year = "2013" if study_id == "de2013-GLES-D"
replace survey_year = "2017" if study_id == "de2017-GLES-N"
replace survey_year = "2017" if study_id == "de2017-GLES-D"
replace survey_year = "2021" if study_id == "de2021-GLES-N"
replace survey_year = "2021" if study_id == "de2021-GLES-D"
replace survey_year = "1963" if study_id == "gb1964-BES-N"
replace survey_year = "1963" if study_id == "gb1964-BES-D"
replace survey_year = "1987" if study_id == "gb1987-BES-N"
replace survey_year = "2005" if study_id == "gb2005-BES-N"
replace survey_year = "2005" if study_id == "gb2005-BES-D"
replace survey_year = "2010" if study_id == "gb2010-BES-N"
replace survey_year = "2010" if study_id == "gb2010-BES-D"
replace survey_year = "2015" if study_id == "gb2015-BES-D"
replace survey_year = "2017" if study_id == "gb2017-BES-D"
replace survey_year = "2019" if study_id == "gb2019-BES-D"
replace survey_year = "2013" if study_id == "he2013-GLES-R"
replace survey_year = "1992" if study_id == "il1992-INES-N"
replace survey_year = "1996" if study_id == "il1996-INES-N1"
replace survey_year = "1996" if study_id == "il1996-INES-N2"
replace survey_year = "2003" if study_id == "il2003-INES-N"
replace survey_year = "2009" if study_id == "il2009-INES-N"
replace survey_year = "2015" if study_id == "il2015-INES-N"
replace survey_year = "2020" if study_id == "il2020-INES-N"
replace survey_year = "2021" if study_id == "il2021-INES-N"
replace survey_year = "2006" if study_id == "it2006-ITANES-N"
replace survey_year = "2013" if study_id == "ni2013-GLES-R"
replace survey_year = "2017" if study_id == "mtl2017-CMES-M"
replace survey_year = "2016" if study_id == "mv2016-GLES-R"
replace survey_year = "2002" if study_id == "nz2002-NZES-N"
replace survey_year = "2002" if study_id == "nz2002-NZES-D"
replace survey_year = "2012" if study_id == "nw2012-GLES-R"
replace survey_year = "2017" if study_id == "nw2017-GLES-R"
replace survey_year = "2003" if study_id == "on2003-OES-R"
replace survey_year = "2003" if study_id == "on2003-OES-D"
replace survey_year = "2007" if study_id == "on2007-OES-R"
replace survey_year = "2011" if study_id == "on2011-Ipsos-R"
replace survey_year = "2011" if study_id == "on2011-Ipsos-D"
replace survey_year = "2014" if study_id == "on2014-Ipsos-R"
replace survey_year = "2014" if study_id == "on2014-Ipsos-D"
replace survey_year = "2008" if study_id == "pt2009-PVS-N1"
replace survey_year = "2008" if study_id == "pt2009-PVS-N2"
replace survey_year = "2017" if study_id == "qc2017-CMES-M"
replace survey_year = "2016" if study_id == "rp2016-GLES-R"
replace survey_year = "2014" if study_id == "sn2014-GLES-R"
replace survey_year = "2017" if study_id == "sh2017-GLES-R"
replace survey_year = "2016" if study_id == "es2016-CIS-N"
replace survey_year = "2019" if study_id == "esA2019-CIS-N"
replace survey_year = "2019" if study_id == "esN2019-CIS-N"
replace survey_year = "2020" if study_id == "sk2020-SKPES-R"
replace survey_year = "2014" if study_id == "th2014-GLES-R"
replace survey_year = "1984-1985" if study_id == "us1984-ANES-N"
replace survey_year = "1984-1985" if study_id == "us1984-ANES-S"
replace survey_year = "1988-1989" if study_id == "us1988-ANES-N"
replace survey_year = "1988-1989" if study_id == "us1988-ANES-S"
replace survey_year = "1992-1993" if study_id == "us1992-ANES-N"
replace survey_year = "1992-1993" if study_id == "us1992-ANES-S"
replace survey_year = "1996" if study_id == "us1996-ANES-N"
replace survey_year = "1996" if study_id == "us1996-ANES-S"
replace survey_year = "2000" if study_id == "us2000-ANES-N"
replace survey_year = "2000" if study_id == "us2000-ANES-USH"
replace survey_year = "2000" if study_id == "us2000-ANES-USS"
replace survey_year = "1999-2001" if study_id == "us2000-NAES-N"
replace survey_year = "1999-2001" if study_id == "us2000-NAES-REP-P"
replace survey_year = "1999-2001" if study_id == "us2000-NAES-DEM-P"
replace survey_year = "2004" if study_id == "us2004-ANES-N"
replace survey_year = "2004" if study_id == "us2004-ANES-S"
replace survey_year = "2003-2005" if study_id == "us2004-NAES-N"
replace survey_year = "2003-2005" if study_id == "us2004-NAES-DEM-P"
replace survey_year = "2008" if study_id == "us2008-ANES-N"
replace survey_year = "2008" if study_id == "us2008-ANES-S"
replace survey_year = "2007-2008" if study_id == "us2008-NAES-N"
replace survey_year = "2007-2008" if study_id == "us2008-NAES-REP-P"
replace survey_year = "2007-2008" if study_id == "us2008-NAES-DEM-P"
replace survey_year = "2012-2013" if study_id == "us2012-ANES-N"
replace survey_year = "2012-2013" if study_id == "us2012-ANES-S"
replace survey_year = "2016-2017" if study_id == "us2016-ANES-N"
replace survey_year = "2016-2017" if study_id == "us2016-ANES-S"
replace survey_year = "2016" if study_id == "us2016-TAPS-N"
replace survey_year = "2016" if study_id == "us2016-TAPS-DEM-P"
replace survey_year = "2016" if study_id == "us2016-TAPS-REP-P"
replace survey_year = "2016" if study_id == "us2016-UAS-N"
replace survey_year = "2020" if study_id == "us2020-ANES-N"
replace survey_year = "2020" if study_id == "us2020-ANES-S"

gen election_year = " "

replace election_year = "2013" if study_id == "at2013-AUTNES-N"
replace election_year = "2017" if study_id == "at2017-AUTNES-N"
replace election_year = "2016" if study_id == "bw2016-GLES-R"
replace election_year = "2013" if study_id == "by2013-GLES-R"
replace election_year = "2014" if study_id == "bb2014-GLES-R"
replace election_year = "1988" if study_id == "ca1988-CES-N"
replace election_year = "1988" if study_id == "ca1988-CES-D"
replace election_year = "1993" if study_id == "ca1993-CES-N"
replace election_year = "1997" if study_id == "ca1997-CES-N"
replace election_year = "2000" if study_id == "ca2000-CES-D"
replace election_year = "2004" if study_id == "ca2004-CES-N"
replace election_year = "2004" if study_id == "ca2004-CES-D"
replace election_year = "2006" if study_id == "ca2006-CES-N"
replace election_year = "2006" if study_id == "ca2006-CES-D"
replace election_year = "2008" if study_id == "ca2008-CES-N"
replace election_year = "2008" if study_id == "ca2008-CES-D"
replace election_year = "2011" if study_id == "ca2011-CES-N"
replace election_year = "2011" if study_id == "ca2011-CES-D"
replace election_year = "2019" if study_id == "ca2019-CES-N1"
replace election_year = "2019" if study_id == "ca2019-CES-N2"
replace election_year = "2019" if study_id == "ca2019-CES-D"
replace election_year = "2011" if study_id == "ca2011-Ipsos-N"
replace election_year = "2011" if study_id == "ca2011-Ipsos-D"
replace election_year = "2015" if study_id == "ca2015-Ipsos-N"
replace election_year = "2015" if study_id == "ca2015-Ipsos-D"
replace election_year = "2002" if study_id == "de2002-GFES-N"
replace election_year = "2009" if study_id == "de2009-GLES-N"
replace election_year = "2009" if study_id == "de2009-GLES-D"
replace election_year = "2013" if study_id == "de2013-GLES-N"
replace election_year = "2013" if study_id == "de2013-GLES-D"
replace election_year = "2017" if study_id == "de2017-GLES-N"
replace election_year = "2017" if study_id == "de2017-GLES-D"
replace election_year = "2021" if study_id == "de2021-GLES-N"
replace election_year = "2021" if study_id == "de2021-GLES-D"
replace election_year = "1964" if study_id == "gb1964-BES-N"
replace election_year = "1964" if study_id == "gb1964-BES-D"
replace election_year = "1987" if study_id == "gb1987-BES-N"
replace election_year = "2005" if study_id == "gb2005-BES-N"
replace election_year = "2005" if study_id == "gb2005-BES-D"
replace election_year = "2010" if study_id == "gb2010-BES-N"
replace election_year = "2010" if study_id == "gb2010-BES-D"
replace election_year = "2015" if study_id == "gb2015-BES-D"
replace election_year = "2017" if study_id == "gb2017-BES-D"
replace election_year = "2019" if study_id == "gb2019-BES-D"
replace election_year = "2013" if study_id == "he2013-GLES-R"
replace election_year = "1992" if study_id == "il1992-INES-N"
replace election_year = "1996" if study_id == "il1996-INES-N1"
replace election_year = "1996" if study_id == "il1996-INES-N2"
replace election_year = "2003" if study_id == "il2003-INES-N"
replace election_year = "2009" if study_id == "il2009-INES-N"
replace election_year = "2015" if study_id == "il2015-INES-N"
replace election_year = "2020" if study_id == "il2020-INES-N"
replace election_year = "2021" if study_id == "il2021-INES-N"
replace election_year = "2006" if study_id == "it2006-ITANES-N"
replace election_year = "2013" if study_id == "ni2013-GLES-R"
replace election_year = "2017" if study_id == "mtl2017-CMES-M"
replace election_year = "2016" if study_id == "mv2016-GLES-R"
replace election_year = "2002" if study_id == "nz2002-NZES-N"
replace election_year = "2002" if study_id == "nz2002-NZES-D"
replace election_year = "2012" if study_id == "nw2012-GLES-R"
replace election_year = "2017" if study_id == "nw2017-GLES-R"
replace election_year = "2003" if study_id == "on2003-OES-R"
replace election_year = "2003" if study_id == "on2003-OES-D"
replace election_year = "2007" if study_id == "on2007-OES-R"
replace election_year = "2011" if study_id == "on2011-Ipsos-R"
replace election_year = "2011" if study_id == "on2011-Ipsos-D"
replace election_year = "2014" if study_id == "on2014-Ipsos-R"
replace election_year = "2014" if study_id == "on2014-Ipsos-D"
replace election_year = "2008" if study_id == "pt2009-PVS-N1"
replace election_year = "2008" if study_id == "pt2009-PVS-N2"
replace election_year = "2017" if study_id == "qc2017-CMES-M"
replace election_year = "2016" if study_id == "rp2016-GLES-R"
replace election_year = "2014" if study_id == "sn2014-GLES-R"
replace election_year = "2017" if study_id == "sh2017-GLES-R"
replace election_year = "2016" if study_id == "es2016-CIS-N"
replace election_year = "2019" if study_id == "esA2019-CIS-N"
replace election_year = "2019" if study_id == "esN2019-CIS-N"
replace election_year = "2020" if study_id == "sk2020-SKPES-R"
replace election_year = "2014" if study_id == "th2014-GLES-R"
replace election_year = "1984" if study_id == "us1984-ANES-N"
replace election_year = "1984" if study_id == "us1984-ANES-S"
replace election_year = "1988" if study_id == "us1988-ANES-N"
replace election_year = "1988" if study_id == "us1988-ANES-S"
replace election_year = "1992" if study_id == "us1992-ANES-N"
replace election_year = "1992" if study_id == "us1992-ANES-S"
replace election_year = "1996" if study_id == "us1996-ANES-N"
replace election_year = "1996" if study_id == "us1996-ANES-S"
replace election_year = "2000" if study_id == "us2000-ANES-N"
replace election_year = "2000" if study_id == "us2000-ANES-USH"
replace election_year = "2000" if study_id == "us2000-ANES-USS"
replace election_year = "2000" if study_id == "us2000-NAES-N"
replace election_year = "2000" if study_id == "us2000-NAES-REP-P"
replace election_year = "2000" if study_id == "us2000-NAES-DEM-P"
replace election_year = "2004" if study_id == "us2004-ANES-N"
replace election_year = "2004" if study_id == "us2004-ANES-S"
replace election_year = "2004" if study_id == "us2004-NAES-N"
replace election_year = "2004" if study_id == "us2004-NAES-DEM-P"
replace election_year = "2008" if study_id == "us2008-ANES-N"
replace election_year = "2008" if study_id == "us2008-ANES-S"
replace election_year = "2008" if study_id == "us2008-NAES-N"
replace election_year = "2008" if study_id == "us2008-NAES-REP-P"
replace election_year = "2008" if study_id == "us2008-NAES-DEM-P"
replace election_year = "2012" if study_id == "us2012-ANES-N"
replace election_year = "2012" if study_id == "us2012-ANES-S"
replace election_year = "2016" if study_id == "us2016-ANES-N"
replace election_year = "2016" if study_id == "us2016-ANES-S"
replace election_year = "2016" if study_id == "us2016-TAPS-N"
replace election_year = "2016" if study_id == "us2016-TAPS-REP-P"
replace election_year = "2016" if study_id == "us2016-TAPS-DEM-P"
replace election_year = "2016" if study_id == "us2016-UAS-N"
replace election_year = "2020" if study_id == "us2020-ANES-N"
replace election_year = "2020" if study_id == "us2020-ANES-S"

gen outcome_type = " "

replace outcome_type = "Coalition" if study_id == "at2013-AUTNES-N"
replace outcome_type = "Coalition" if study_id == "at2017-AUTNES-N"
replace outcome_type = "Coalition" if study_id == "bw2016-GLES-R"
replace outcome_type = "Coalition" if study_id == "by2013-GLES-R"
replace outcome_type = "Coalition" if study_id == "bb2014-GLES-R"
replace outcome_type = "Winning election" if study_id == "ca1988-CES-N"
replace outcome_type = "Winning district" if study_id == "ca1988-CES-D"
replace outcome_type = "Winning election" if study_id == "ca1993-CES-N"
replace outcome_type = "Winning election" if study_id == "ca1997-CES-N"
replace outcome_type = "Winning district" if study_id == "ca2000-CES-D"
replace outcome_type = "Most seats" if study_id == "ca2004-CES-N"
replace outcome_type = "Winning district" if study_id == "ca2004-CES-D"
replace outcome_type = "Winning most seats" if study_id == "ca2006-CES-N"
replace outcome_type = "Winning district" if study_id == "ca2006-CES-D"
replace outcome_type = "Winning most seats" if study_id == "ca2008-CES-N"
replace outcome_type = "Winning district" if study_id == "ca2008-CES-D"
replace outcome_type = "Government" if study_id == "ca2011-CES-N"
replace outcome_type = "Winning district" if study_id == "ca2011-CES-D"
replace outcome_type = "Most seats" if study_id == "ca2019-CES-N1"
replace outcome_type = "Seat majority" if study_id == "ca2019-CES-N2"
replace outcome_type = "Winning district" if study_id == "ca2019-CES-D"
replace outcome_type = "Winning election" if study_id == "ca2011-Ipsos-N"
replace outcome_type = "Winning district" if study_id == "ca2011-Ipsos-D"
replace outcome_type = "Winning election" if study_id == "ca2015-Ipsos-N"
replace outcome_type = "Winning district" if study_id == "ca2015-Ipsos-D"
replace outcome_type = "Most votes" if study_id == "de2002-GFES-N"
replace outcome_type = "Seat majority" if study_id == "de2009-GLES-N"
replace outcome_type = "Winning district" if study_id == "de2009-GLES-D"
replace outcome_type = "Coalition" if study_id == "de2013-GLES-N"
replace outcome_type = "Winning district" if study_id == "de2013-GLES-D"
replace outcome_type = "Coalition" if study_id == "de2017-GLES-N"
replace outcome_type = "Winning district" if study_id == "de2017-GLES-D"
replace outcome_type = "Coalition" if study_id == "de2021-GLES-N"
replace outcome_type = "Winning district" if study_id == "de2021-GLES-D"
replace outcome_type = "Winning election" if study_id == "gb1964-BES-N"
replace outcome_type = "Winning district" if study_id == "gb1964-BES-D"
replace outcome_type = "Seat majority" if study_id == "gb1987-BES-N"
replace outcome_type = "Winning election" if study_id == "gb2005-BES-N"
replace outcome_type = "Winning district" if study_id == "gb2005-BES-D"
replace outcome_type = "Winning election" if study_id == "gb2010-BES-N"
replace outcome_type = "Winning district" if study_id == "gb2010-BES-D"
replace outcome_type = "Winning district" if study_id == "gb2015-BES-D"
replace outcome_type = "Winning district" if study_id == "gb2017-BES-D"
replace outcome_type = "Winning district" if study_id == "gb2019-BES-D"
replace outcome_type = "Coalition" if study_id == "he2013-GLES-R"
replace outcome_type = "Leading party" if study_id == "il1992-INES-N"
replace outcome_type = "Prime minister" if study_id == "il1996-INES-N1"
replace outcome_type = "Largest party" if study_id == "il1996-INES-N2"
replace outcome_type = "Coalition" if study_id == "il2003-INES-N"
replace outcome_type = "Prime minister" if study_id == "il2009-INES-N"
replace outcome_type = "Coalition" if study_id == "il2015-INES-N"
replace outcome_type = "Coalition" if study_id == "il2020-INES-N"
replace outcome_type = "Coalition" if study_id == "il2021-INES-N"
replace outcome_type = "Coalition" if study_id == "it2006-ITANES-N"
replace outcome_type = "Coalition" if study_id == "ni2013-GLES-R"
replace outcome_type = "Mayor" if study_id == "mtl2017-CMES-M"
replace outcome_type = "Coalition" if study_id == "mv2016-GLES-R"
replace outcome_type = "Labour or National in government" if study_id == "nz2002-NZES-N"
replace outcome_type = "Winning district" if study_id == "nz2002-NZES-D"
replace outcome_type = "Coalition" if study_id == "nw2012-GLES-R"
replace outcome_type = "Coalition" if study_id == "nw2017-GLES-R"
replace outcome_type = "Winning election" if study_id == "on2003-OES-R"
replace outcome_type = "Winning district" if study_id == "on2003-OES-D"
replace outcome_type = "Most seats" if study_id == "on2007-OES-R"
replace outcome_type = "Winning election" if study_id == "on2011-Ipsos-R"
replace outcome_type = "Winning district" if study_id == "on2011-Ipsos-D"
replace outcome_type = "Winning election" if study_id == "on2014-Ipsos-R"
replace outcome_type = "Winning district" if study_id == "on2014-Ipsos-D"
replace outcome_type = "Most votes" if study_id == "pt2009-PVS-N1"
replace outcome_type = "Seat majority" if study_id == "pt2009-PVS-N2"
replace outcome_type = "Mayor" if study_id == "qc2017-CMES-M"
replace outcome_type = "Coalition" if study_id == "rp2016-GLES-R"
replace outcome_type = "Coalition" if study_id == "sn2014-GLES-R"
replace outcome_type = "Coalition" if study_id == "sh2017-GLES-R"
replace outcome_type = "Most votes" if study_id == "es2016-CIS-N"
replace outcome_type = "Most votes" if study_id == "esA2019-CIS-N"
replace outcome_type = "Winning election" if study_id == "esN2019-CIS-N"
replace outcome_type = "Most seats" if study_id == "sk2020-SKPES-R"
replace outcome_type = "Coalition" if study_id == "th2014-GLES-R"
replace outcome_type = "President" if study_id == "us1984-ANES-N"
replace outcome_type = "State winner" if study_id == "us1984-ANES-S"
replace outcome_type = "President" if study_id == "us1988-ANES-N"
replace outcome_type = "State winner" if study_id == "us1988-ANES-S"
replace outcome_type = "President" if study_id == "us1992-ANES-N"
replace outcome_type = "State winner" if study_id == "us1992-ANES-S"
replace outcome_type = "President" if study_id == "us1996-ANES-N"
replace outcome_type = "State winner" if study_id == "us1996-ANES-S"
replace outcome_type = "President" if study_id == "us2000-ANES-N"
replace outcome_type = "Most House members" if study_id == "us2000-ANES-USH"
replace outcome_type = "Most Senate members" if study_id == "us2000-ANES-USS"
replace outcome_type = "President" if study_id == "us2000-NAES-N"
replace outcome_type = "Republican nominee" if study_id == "us2000-NAES-REP-P"
replace outcome_type = "Democratic nominee" if study_id == "us2000-NAES-DEM-P"
replace outcome_type = "President" if study_id == "us2004-ANES-N"
replace outcome_type = "State winner" if study_id == "us2004-ANES-S"
replace outcome_type = "President" if study_id == "us2004-NAES-N"
replace outcome_type = "Democratic nominee" if study_id == "us2004-NAES-DEM-P"
replace outcome_type = "President" if study_id == "us2008-ANES-N"
replace outcome_type = "State winner" if study_id == "us2008-ANES-S"
replace outcome_type = "President" if study_id == "us2008-NAES-N"
replace outcome_type = "Republican nominee" if study_id == "us2008-NAES-REP-P"
replace outcome_type = "Democratic nominee" if study_id == "us2008-NAES-DEM-P"
replace outcome_type = "President" if study_id == "us2012-ANES-N"
replace outcome_type = "State winner" if study_id == "us2012-ANES-S"
replace outcome_type = "President" if study_id == "us2016-ANES-N"
replace outcome_type = "State winner" if study_id == "us2016-ANES-S"
replace outcome_type = "President" if study_id == "us2016-TAPS-N"
replace outcome_type = "Republican nominee" if study_id == "us2016-TAPS-REP-P"
replace outcome_type = "Democratic nominee" if study_id == "us2016-TAPS-DEM-P"
replace outcome_type = "President" if study_id == "us2016-UAS-N"
replace outcome_type = "President" if study_id == "us2020-ANES-N"
replace outcome_type = "State winner" if study_id == "us2020-ANES-S"

gen forecast_type = " "

replace forecast_type = "Probability" if study_id == "at2013-AUTNES-N"
replace forecast_type = "Probability" if study_id == "at2017-AUTNES-N"
replace forecast_type = "Probability" if study_id == "bw2016-GLES-R"
replace forecast_type = "Probability" if study_id == "by2013-GLES-R"
replace forecast_type = "Probability" if study_id == "bb2014-GLES-R"
replace forecast_type = "Probability" if study_id == "ca1988-CES-N"
replace forecast_type = "Probability" if study_id == "ca1988-CES-D"
replace forecast_type = "Probability" if study_id == "ca1993-CES-N"
replace forecast_type = "Probability" if study_id == "ca1997-CES-N"
replace forecast_type = "Probability" if study_id == "ca2000-CES-D"
replace forecast_type = "Probability" if study_id == "ca2004-CES-N"
replace forecast_type = "Probability" if study_id == "ca2004-CES-D"
replace forecast_type = "Qualitative" if study_id == "ca2006-CES-N"
replace forecast_type = "Qualitative" if study_id == "ca2006-CES-D"
replace forecast_type = "Qualitative" if study_id == "ca2008-CES-N"
replace forecast_type = "Qualitative" if study_id == "ca2008-CES-D"
replace forecast_type = "Qualitative" if study_id == "ca2011-CES-N"
replace forecast_type = "Qualitative" if study_id == "ca2011-CES-D"
replace forecast_type = "Qualitative" if study_id == "ca2019-CES-N1"
replace forecast_type = "Qualitative" if study_id == "ca2019-CES-N2"
replace forecast_type = "Qualitative" if study_id == "ca2019-CES-D"
replace forecast_type = "Qualitative" if study_id == "ca2011-Ipsos-N"
replace forecast_type = "Qualitative" if study_id == "ca2011-Ipsos-D"
replace forecast_type = "Qualitative" if study_id == "ca2015-Ipsos-N"
replace forecast_type = "Qualitative" if study_id == "ca2015-Ipsos-D"
replace forecast_type = "Qualitative" if study_id == "de2002-GFES-N"
replace forecast_type = "Qualitative" if study_id == "de2009-GLES-N"
replace forecast_type = "Qualitative" if study_id == "de2009-GLES-D"
replace forecast_type = "Probability" if study_id == "de2013-GLES-N"
replace forecast_type = "Qualitative" if study_id == "de2013-GLES-D"
replace forecast_type = "Qualitative" if study_id == "de2017-GLES-N"
replace forecast_type = "Qualitative" if study_id == "de2017-GLES-D"
replace forecast_type = "Qualitative" if study_id == "de2021-GLES-N"
replace forecast_type = "Qualitative" if study_id == "de2021-GLES-D"
replace forecast_type = "Qualitative" if study_id == "gb1964-BES-N"
replace forecast_type = "Qualitative" if study_id == "gb1964-BES-D"
replace forecast_type = "Probability" if study_id == "gb1987-BES-N"
replace forecast_type = "Probability" if study_id == "gb2005-BES-N"
replace forecast_type = "Probability" if study_id == "gb2005-BES-D"
replace forecast_type = "Probability" if study_id == "gb2010-BES-N"
replace forecast_type = "Probability" if study_id == "gb2010-BES-D"
replace forecast_type = "Probability" if study_id == "gb2015-BES-D"
replace forecast_type = "Probability" if study_id == "gb2017-BES-D"
replace forecast_type = "Probability" if study_id == "gb2019-BES-D"
replace forecast_type = "Probability" if study_id == "he2013-GLES-R"
replace forecast_type = "Qualitative" if study_id == "il1992-INES-N"
replace forecast_type = "Qualitative" if study_id == "il1996-INES-N1"
replace forecast_type = "Qualitative" if study_id == "il1996-INES-N2"
replace forecast_type = "Qualitative" if study_id == "il2003-INES-N"
replace forecast_type = "Probability" if study_id == "il2009-INES-N"
replace forecast_type = "Qualitative" if study_id == "il2015-INES-N"
replace forecast_type = "Qualitative" if study_id == "il2020-INES-N"
replace forecast_type = "Qualitative" if study_id == "il2021-INES-N"
replace forecast_type = "Probability" if study_id == "it2006-ITANES-N"
replace forecast_type = "Qualitative" if study_id == "ni2013-GLES-R"
replace forecast_type = "Probability" if study_id == "mtl2017-CMES-M"
replace forecast_type = "Probability" if study_id == "mv2016-GLES-R"
replace forecast_type = "Probability" if study_id == "nz2002-NZES-N"
replace forecast_type = "Qualitative" if study_id == "nz2002-NZES-D"
replace forecast_type = "Qualitative" if study_id == "nw2012-GLES-R"
replace forecast_type = "Probability" if study_id == "nw2017-GLES-R"
replace forecast_type = "Qualitative" if study_id == "on2003-OES-R"
replace forecast_type = "Probability" if study_id == "on2003-OES-D"
replace forecast_type = "Qualitative" if study_id == "on2007-OES-R"
replace forecast_type = "Qualitative" if study_id == "on2011-Ipsos-R"
replace forecast_type = "Qualitative" if study_id == "on2011-Ipsos-D"
replace forecast_type = "Qualitative" if study_id == "on2014-Ipsos-R"
replace forecast_type = "Qualitative" if study_id == "on2014-Ipsos-D"
replace forecast_type = "Qualitative" if study_id == "pt2009-PVS-N1"
replace forecast_type = "Qualitative" if study_id == "pt2009-PVS-N2"
replace forecast_type = "Probability" if study_id == "qc2017-CMES-M"
replace forecast_type = "Probability" if study_id == "rp2016-GLES-R"
replace forecast_type = "Probability" if study_id == "sn2014-GLES-R"
replace forecast_type = "Probability" if study_id == "sh2017-GLES-R"
replace forecast_type = "Qualitative" if study_id == "es2016-CIS-N"
replace forecast_type = "Qualitative" if study_id == "esA2019-CIS-N"
replace forecast_type = "Qualitative" if study_id == "esN2019-CIS-N"
replace forecast_type = "Qualitative" if study_id == "sk2020-SKPES-R"
replace forecast_type = "Probability" if study_id == "th2014-GLES-R"
replace forecast_type = "Qualitative" if study_id == "us1984-ANES-N"
replace forecast_type = "Qualitative" if study_id == "us1984-ANES-S"
replace forecast_type = "Qualitative" if study_id == "us1988-ANES-N"
replace forecast_type = "Qualitative" if study_id == "us1988-ANES-S"
replace forecast_type = "Qualitative" if study_id == "us1992-ANES-N"
replace forecast_type = "Qualitative" if study_id == "us1992-ANES-S"
replace forecast_type = "Qualitative" if study_id == "us1996-ANES-N"
replace forecast_type = "Qualitative" if study_id == "us1996-ANES-S"
replace forecast_type = "Qualitative" if study_id == "us2000-ANES-N"
replace forecast_type = "Qualitative" if study_id == "us2000-ANES-USH"
replace forecast_type = "Qualitative" if study_id == "us2000-ANES-USS"
replace forecast_type = "Probability" if study_id == "us2000-NAES-N"
replace forecast_type = "Probability" if study_id == "us2000-NAES-REP-P"
replace forecast_type = "Probability" if study_id == "us2000-NAES-DEM-P"
replace forecast_type = "Qualitative" if study_id == "us2004-ANES-N"
replace forecast_type = "Qualitative" if study_id == "us2004-ANES-S"
replace forecast_type = "Probability" if study_id == "us2004-NAES-N"
replace forecast_type = "Probability" if study_id == "us2004-NAES-DEM-P"
replace forecast_type = "Qualitative" if study_id == "us2008-ANES-N"
replace forecast_type = "Qualitative" if study_id == "us2008-ANES-S"
replace forecast_type = "Probability" if study_id == "us2008-NAES-N"
replace forecast_type = "Probability" if study_id == "us2008-NAES-REP-P"
replace forecast_type = "Probability" if study_id == "us2008-NAES-DEM-P"
replace forecast_type = "Qualitative" if study_id == "us2012-ANES-N"
replace forecast_type = "Qualitative" if study_id == "us2012-ANES-S"
replace forecast_type = "Qualitative" if study_id == "us2016-ANES-N"
replace forecast_type = "Qualitative" if study_id == "us2016-ANES-S"
replace forecast_type = "Qualitative" if study_id == "us2016-TAPS-N"
replace forecast_type = "Qualitative" if study_id == "us2016-TAPS-REP-P"
replace forecast_type = "Qualitative" if study_id == "us2016-TAPS-DEM-P"
replace forecast_type = "Probability" if study_id == "us2016-UAS-N"
replace forecast_type = "Qualitative" if study_id == "us2020-ANES-N"
replace forecast_type = "Qualitative" if study_id == "us2020-ANES-S"

gen answer_choices = " "

replace answer_choices = "3-5" if study_id == "at2013-AUTNES-N"
replace answer_choices = "3-5" if study_id == "at2017-AUTNES-N"
replace answer_choices = "6+" if study_id == "bw2016-GLES-R"
replace answer_choices = "6+" if study_id == "by2013-GLES-R"
replace answer_choices = "6+" if study_id == "bb2014-GLES-R"
replace answer_choices = "3-5" if study_id == "ca1988-CES-N"
replace answer_choices = "3-5" if study_id == "ca1988-CES-D"
replace answer_choices = "3-5" if study_id == "ca1993-CES-N"
replace answer_choices = "3-5" if study_id == "ca1997-CES-N"
replace answer_choices = "3-5" if study_id == "ca2000-CES-D"
replace answer_choices = "3-5" if study_id == "ca2004-CES-N"
replace answer_choices = "3-5" if study_id == "ca2004-CES-D"
replace answer_choices = "3-5" if study_id == "ca2006-CES-N"
replace answer_choices = "3-5" if study_id == "ca2006-CES-D"
replace answer_choices = "3-5" if study_id == "ca2008-CES-N"
replace answer_choices = "3-5" if study_id == "ca2008-CES-D"
replace answer_choices = "3-5" if study_id == "ca2011-CES-N"
replace answer_choices = "3-5" if study_id == "ca2011-CES-D"
replace answer_choices = "6+" if study_id == "ca2019-CES-N1"
replace answer_choices = "3-5" if study_id == "ca2019-CES-N2"
replace answer_choices = "6+" if study_id == "ca2019-CES-D"
replace answer_choices = "3-5" if study_id == "ca2011-Ipsos-N"
replace answer_choices = "3-5" if study_id == "ca2011-Ipsos-D"
replace answer_choices = "3-5" if study_id == "ca2015-Ipsos-N"
replace answer_choices = "3-5" if study_id == "ca2015-Ipsos-D"
replace answer_choices = "3-5" if study_id == "de2002-GFES-N"
replace answer_choices = "3-5" if study_id == "de2009-GLES-N"
replace answer_choices = "3-5" if study_id == "de2009-GLES-D"
replace answer_choices = "6+" if study_id == "de2013-GLES-N"
replace answer_choices = "6+" if study_id == "de2013-GLES-D"
replace answer_choices = "6+" if study_id == "de2017-GLES-N"
replace answer_choices = "6+" if study_id == "de2017-GLES-D"
replace answer_choices = "6+" if study_id == "de2021-GLES-N"
replace answer_choices = "6+" if study_id == "de2021-GLES-D"
replace answer_choices = "3-5" if study_id == "gb1964-BES-N"
replace answer_choices = "6+" if study_id == "gb1964-BES-D"
replace answer_choices = "3-5" if study_id == "gb1987-BES-N"
replace answer_choices = "3-5" if study_id == "gb2005-BES-N"
replace answer_choices = "6+" if study_id == "gb2005-BES-D"
replace answer_choices = "3-5" if study_id == "gb2010-BES-N"
replace answer_choices = "3-5" if study_id == "gb2010-BES-D"
replace answer_choices = "6+" if study_id == "gb2015-BES-D"
replace answer_choices = "6+" if study_id == "gb2017-BES-D"
replace answer_choices = "6+" if study_id == "gb2019-BES-D"
replace answer_choices = "6+" if study_id == "he2013-GLES-R"
replace answer_choices = "3-5" if study_id == "il1992-INES-N"
replace answer_choices = "2" if study_id == "il1996-INES-N1"
replace answer_choices = "2" if study_id == "il1996-INES-N2"
replace answer_choices = "3-5" if study_id == "il2003-INES-N"
replace answer_choices = "3-5" if study_id == "il2009-INES-N"
replace answer_choices = "3-5" if study_id == "il2015-INES-N"
replace answer_choices = "6+" if study_id == "il2020-INES-N"
replace answer_choices = "6+" if study_id == "il2021-INES-N"
replace answer_choices = "2" if study_id == "it2006-ITANES-N"
replace answer_choices = "3-5" if study_id == "ni2013-GLES-R"
replace answer_choices = "3-5" if study_id == "mtl2017-CMES-M"
replace answer_choices = "6+" if study_id == "mv2016-GLES-R"
replace answer_choices = "2" if study_id == "nz2002-NZES-N"
replace answer_choices = "6+" if study_id == "nz2002-NZES-D"
replace answer_choices = "6+" if study_id == "nw2012-GLES-R"
replace answer_choices = "6+" if study_id == "nw2017-GLES-R"
replace answer_choices = "3-5" if study_id == "on2003-OES-R"
replace answer_choices = "3-5" if study_id == "on2003-OES-D"
replace answer_choices = "3-5" if study_id == "on2007-OES-R"
replace answer_choices = "3-5" if study_id == "on2011-Ipsos-R"
replace answer_choices = "3-5" if study_id == "on2011-Ipsos-D"
replace answer_choices = "3-5" if study_id == "on2014-Ipsos-R"
replace answer_choices = "3-5" if study_id == "on2014-Ipsos-D"
replace answer_choices = "2" if study_id == "pt2009-PVS-N1"
replace answer_choices = "2" if study_id == "pt2009-PVS-N2"
replace answer_choices = "6+" if study_id == "qc2017-CMES-M"
replace answer_choices = "6+" if study_id == "rp2016-GLES-R"
replace answer_choices = "6+" if study_id == "sn2014-GLES-R"
replace answer_choices = "6+" if study_id == "sh2017-GLES-R"
replace answer_choices = "6+" if study_id == "es2016-CIS-N"
replace answer_choices = "6+" if study_id == "esA2019-CIS-N"
replace answer_choices = "6+" if study_id == "esN2019-CIS-N"
replace answer_choices = "6+" if study_id == "sk2020-SKPES-R"
replace answer_choices = "6+" if study_id == "th2014-GLES-R"
replace answer_choices = "2" if study_id == "us1984-ANES-N"
replace answer_choices = "2" if study_id == "us1984-ANES-S"
replace answer_choices = "2" if study_id == "us1988-ANES-N"
replace answer_choices = "2" if study_id == "us1988-ANES-S"
replace answer_choices = "2" if study_id == "us1992-ANES-N"
replace answer_choices = "2" if study_id == "us1992-ANES-S"
replace answer_choices = "3-5" if study_id == "us1996-ANES-N"
replace answer_choices = "3-5" if study_id == "us1996-ANES-S"
replace answer_choices = "3-5" if study_id == "us2000-ANES-N"
replace answer_choices = "2" if study_id == "us2000-ANES-USH"
replace answer_choices = "2" if study_id == "us2000-ANES-USS"
replace answer_choices = "2" if study_id == "us2000-NAES-N"
replace answer_choices = "3-5" if study_id == "us2000-NAES-REP-P"
replace answer_choices = "2" if study_id == "us2000-NAES-DEM-P"
replace answer_choices = "3-5" if study_id == "us2004-ANES-N"
replace answer_choices = "3-5" if study_id == "us2004-ANES-S"
replace answer_choices = "2" if study_id == "us2004-NAES-N"
replace answer_choices = "6+" if study_id == "us2004-NAES-DEM-P"
replace answer_choices = "2" if study_id == "us2008-ANES-N"
replace answer_choices = "2" if study_id == "us2008-ANES-S"
replace answer_choices = "2" if study_id == "us2008-NAES-N"
replace answer_choices = "3-5" if study_id == "us2008-NAES-REP-P"
replace answer_choices = "3-5" if study_id == "us2008-NAES-DEM-P"
replace answer_choices = "2" if study_id == "us2012-ANES-N"
replace answer_choices = "2" if study_id == "us2012-ANES-S"
replace answer_choices = "2" if study_id == "us2016-ANES-N"
replace answer_choices = "2" if study_id == "us2016-ANES-S"
replace answer_choices = "3-5" if study_id == "us2016-TAPS-N"
replace answer_choices = "3-5" if study_id == "us2016-TAPS-REP-P"
replace answer_choices = "2" if study_id == "us2016-TAPS-DEM-P"
replace answer_choices = "3-5" if study_id == "us2016-UAS-N"
replace answer_choices = "2" if study_id == "us2020-ANES-N"
replace answer_choices = "2" if study_id == "us2020-ANES-S"

gen election_type = " "

replace election_type = "Legislative" if study_id == "at2013-AUTNES-N" 
replace election_type = "Legislative" if study_id == "at2017-AUTNES-N" 
replace election_type = "Legislative" if study_id == "bw2016-GLES-R" 
replace election_type = "Legislative" if study_id == "by2013-GLES-R" 
replace election_type = "Legislative" if study_id == "bb2014-GLES-R" 
replace election_type = "Legislative" if study_id == "ca1988-CES-N" 
replace election_type = "Legislative" if study_id == "ca1988-CES-D" 
replace election_type = "Legislative" if study_id == "ca1993-CES-N" 
replace election_type = "Legislative" if study_id == "ca1997-CES-N" 
replace election_type = "Legislative" if study_id == "ca2000-CES-D" 
replace election_type = "Legislative" if study_id == "ca2004-CES-N" 
replace election_type = "Legislative" if study_id == "ca2004-CES-D" 
replace election_type = "Legislative" if study_id == "ca2006-CES-N" 
replace election_type = "Legislative" if study_id == "ca2006-CES-D" 
replace election_type = "Legislative" if study_id == "ca2008-CES-N" 
replace election_type = "Legislative" if study_id == "ca2008-CES-D" 
replace election_type = "Legislative" if study_id == "ca2011-CES-N" 
replace election_type = "Legislative" if study_id == "ca2011-CES-D" 
replace election_type = "Legislative" if study_id == "ca2019-CES-N1"
replace election_type = "Legislative" if study_id == "ca2019-CES-N2"
replace election_type = "Legislative" if study_id == "ca2019-CES-D"
replace election_type = "Legislative" if study_id == "ca2011-Ipsos-N" 
replace election_type = "Legislative" if study_id == "ca2011-Ipsos-D" 
replace election_type = "Legislative" if study_id == "ca2015-Ipsos-N" 
replace election_type = "Legislative" if study_id == "ca2015-Ipsos-D" 
replace election_type = "Legislative" if study_id == "de2002-GFES-N" 
replace election_type = "Legislative" if study_id == "de2009-GLES-N" 
replace election_type = "Legislative" if study_id == "de2009-GLES-D" 
replace election_type = "Legislative" if study_id == "de2013-GLES-N" 
replace election_type = "Legislative" if study_id == "de2013-GLES-D" 
replace election_type = "Legislative" if study_id == "de2017-GLES-N" 
replace election_type = "Legislative" if study_id == "de2017-GLES-D" 
replace election_type = "Legislative" if study_id == "de2021-GLES-N" 
replace election_type = "Legislative" if study_id == "de2021-GLES-D"
replace election_type = "Legislative" if study_id == "gb1964-BES-N"
replace election_type = "Legislative" if study_id == "gb1964-BES-D"
replace election_type = "Legislative" if study_id == "gb1987-BES-N"
replace election_type = "Legislative" if study_id == "gb2005-BES-N"
replace election_type = "Legislative" if study_id == "gb2005-BES-D"
replace election_type = "Legislative" if study_id == "gb2010-BES-N"
replace election_type = "Legislative" if study_id == "gb2010-BES-D"
replace election_type = "Legislative" if study_id == "gb2015-BES-D" 
replace election_type = "Legislative" if study_id == "gb2017-BES-D" 
replace election_type = "Legislative" if study_id == "gb2019-BES-D" 
replace election_type = "Legislative" if study_id == "he2013-GLES-R" 
replace election_type = "Legislative" if study_id == "il1992-INES-N" 
replace election_type = "Executive" if study_id == "il1996-INES-N1" 
replace election_type = "Legislative" if study_id == "il1996-INES-N2" 
replace election_type = "Legislative" if study_id == "il2003-INES-N" 
replace election_type = "Legislative" if study_id == "il2009-INES-N" 
replace election_type = "Legislative" if study_id == "il2015-INES-N" 
replace election_type = "Legislative" if study_id == "il2020-INES-N" 
replace election_type = "Legislative" if study_id == "il2021-INES-N" 
replace election_type = "Legislative" if study_id == "it2006-ITANES-N" 
replace election_type = "Legislative" if study_id == "ni2013-GLES-R" 
replace election_type = "Executive" if study_id == "mtl2017-CMES-M" 
replace election_type = "Legislative" if study_id == "mv2016-GLES-R" 
replace election_type = "Legislative" if study_id == "nz2002-NZES-N" 
replace election_type = "Legislative" if study_id == "nz2002-NZES-D" 
replace election_type = "Legislative" if study_id == "nw2012-GLES-R" 
replace election_type = "Legislative" if study_id == "nw2017-GLES-R" 
replace election_type = "Legislative" if study_id == "on2003-OES-R"
replace election_type = "Legislative" if study_id == "on2003-OES-D"
replace election_type = "Legislative" if study_id == "on2007-OES-R"
replace election_type = "Legislative" if study_id == "on2011-Ipsos-R" 
replace election_type = "Legislative" if study_id == "on2011-Ipsos-D" 
replace election_type = "Legislative" if study_id == "on2014-Ipsos-R" 
replace election_type = "Legislative" if study_id == "on2014-Ipsos-D" 
replace election_type = "Legislative" if study_id == "pt2009-PVS-N1" 
replace election_type = "Legislative" if study_id == "pt2009-PVS-N2" 
replace election_type = "Executive" if study_id == "qc2017-CMES-M" 
replace election_type = "Legislative" if study_id == "rp2016-GLES-R" 
replace election_type = "Legislative" if study_id == "sn2014-GLES-R" 
replace election_type = "Legislative" if study_id == "sh2017-GLES-R" 
replace election_type = "Legislative" if study_id == "es2016-CIS-N" 
replace election_type = "Legislative" if study_id == "esA2019-CIS-N" 
replace election_type = "Legislative" if study_id == "esN2019-CIS-N"
replace election_type = "Legislative" if study_id == "sk2020-SKPES-R" 
replace election_type = "Legislative" if study_id == "th2014-GLES-R" 
replace election_type = "Executive" if study_id == "us1984-ANES-N" 
replace election_type = "Executive" if study_id == "us1984-ANES-S" 
replace election_type = "Executive" if study_id == "us1988-ANES-N" 
replace election_type = "Executive" if study_id == "us1988-ANES-S" 
replace election_type = "Executive" if study_id == "us1992-ANES-N" 
replace election_type = "Executive" if study_id == "us1992-ANES-S" 
replace election_type = "Executive" if study_id == "us1996-ANES-N" 
replace election_type = "Executive" if study_id == "us1996-ANES-S" 
replace election_type = "Executive" if study_id == "us2000-ANES-N" 
replace election_type = "Legislative" if study_id == "us2000-ANES-USH" 
replace election_type = "Legislative" if study_id == "us2000-ANES-USS" 
replace election_type = "Executive" if study_id == "us2000-NAES-N" 
replace election_type = "Primaries" if study_id == "us2000-NAES-REP-P" 
replace election_type = "Primaries" if study_id == "us2000-NAES-DEM-P" 
replace election_type = "Executive" if study_id == "us2004-ANES-N" 
replace election_type = "Executive" if study_id == "us2004-ANES-S" 
replace election_type = "Executive" if study_id == "us2004-NAES-N" 
replace election_type = "Primaries" if study_id == "us2004-NAES-DEM-P" 
replace election_type = "Executive" if study_id == "us2008-ANES-N" 
replace election_type = "Executive" if study_id == "us2008-ANES-S" 
replace election_type = "Executive" if study_id == "us2008-NAES-N"
replace election_type = "Primaries" if study_id == "us2008-NAES-REP-P"
replace election_type = "Primaries" if study_id == "us2008-NAES-DEM-P"
replace election_type = "Executive" if study_id == "us2012-ANES-N" 
replace election_type = "Executive" if study_id == "us2012-ANES-S" 
replace election_type = "Executive" if study_id == "us2016-ANES-N" 
replace election_type = "Executive" if study_id == "us2016-ANES-S" 
replace election_type = "Executive" if study_id == "us2016-TAPS-N"
replace election_type = "Primaries" if study_id == "us2016-TAPS-REP-P"
replace election_type = "Primaries" if study_id == "us2016-TAPS-DEM-P"
replace election_type = "Executive" if study_id == "us2016-UAS-N"
replace election_type = "Executive" if study_id == "us2020-ANES-N" 
replace election_type = "Executive" if study_id == "us2020-ANES-S" 

gen election_level = " "

replace election_level = "National" if study_id == "at2013-AUTNES-N"
replace election_level = "National" if study_id == "at2017-AUTNES-N"
replace election_level = "Regional" if study_id == "bw2016-GLES-R"
replace election_level = "Regional" if study_id == "by2013-GLES-R"
replace election_level = "Regional" if study_id == "bb2014-GLES-R"
replace election_level = "National" if study_id == "ca1988-CES-N"
replace election_level = "District" if study_id == "ca1988-CES-D"
replace election_level = "National" if study_id == "ca1993-CES-N"
replace election_level = "National" if study_id == "ca1997-CES-N"
replace election_level = "District" if study_id == "ca2000-CES-D"
replace election_level = "National" if study_id == "ca2004-CES-N"
replace election_level = "District" if study_id == "ca2004-CES-D"
replace election_level = "National" if study_id == "ca2006-CES-N"
replace election_level = "District" if study_id == "ca2006-CES-D"
replace election_level = "National" if study_id == "ca2008-CES-N"
replace election_level = "District" if study_id == "ca2008-CES-D"
replace election_level = "National" if study_id == "ca2011-CES-N"
replace election_level = "District" if study_id == "ca2011-CES-D"
replace election_level = "National" if study_id == "ca2019-CES-N1"
replace election_level = "National" if study_id == "ca2019-CES-N2"
replace election_level = "District" if study_id == "ca2019-CES-D"
replace election_level = "National" if study_id == "ca2011-Ipsos-N"
replace election_level = "District" if study_id == "ca2011-Ipsos-D"
replace election_level = "National" if study_id == "ca2015-Ipsos-N"
replace election_level = "District" if study_id == "ca2015-Ipsos-D"
replace election_level = "National" if study_id == "de2002-GFES-N"
replace election_level = "National" if study_id == "de2009-GLES-N"
replace election_level = "District" if study_id == "de2009-GLES-D"
replace election_level = "National" if study_id == "de2013-GLES-N"
replace election_level = "District" if study_id == "de2013-GLES-D"
replace election_level = "National" if study_id == "de2017-GLES-N"
replace election_level = "District" if study_id == "de2017-GLES-D"
replace election_level = "National" if study_id == "de2021-GLES-N"
replace election_level = "District" if study_id == "de2021-GLES-D"
replace election_level = "National" if study_id == "gb1964-BES-N"
replace election_level = "District" if study_id == "gb1964-BES-D"
replace election_level = "National" if study_id == "gb1987-BES-N"
replace election_level = "National" if study_id == "gb2005-BES-N"
replace election_level = "District" if study_id == "gb2005-BES-D"
replace election_level = "National" if study_id == "gb2010-BES-N"
replace election_level = "District" if study_id == "gb2010-BES-D"
replace election_level = "District" if study_id == "gb2015-BES-D"
replace election_level = "District" if study_id == "gb2017-BES-D"
replace election_level = "District" if study_id == "gb2019-BES-D"
replace election_level = "Regional" if study_id == "he2013-GLES-R"
replace election_level = "National" if study_id == "il1992-INES-N"
replace election_level = "National" if study_id == "il1996-INES-N1"
replace election_level = "National" if study_id == "il1996-INES-N2"
replace election_level = "National" if study_id == "il2003-INES-N"
replace election_level = "National" if study_id == "il2009-INES-N"
replace election_level = "National" if study_id == "il2015-INES-N"
replace election_level = "National" if study_id == "il2020-INES-N"
replace election_level = "National" if study_id == "il2021-INES-N"
replace election_level = "National" if study_id == "it2006-ITANES-N"
replace election_level = "Regional" if study_id == "ni2013-GLES-R"
replace election_level = "Municipal" if study_id == "mtl2017-CMES-M"
replace election_level = "Regional" if study_id == "mv2016-GLES-R"
replace election_level = "National" if study_id == "nz2002-NZES-N"
replace election_level = "District" if study_id == "nz2002-NZES-D"
replace election_level = "Regional" if study_id == "nw2012-GLES-R"
replace election_level = "Regional" if study_id == "nw2017-GLES-R"
replace election_level = "Regional" if study_id == "on2003-OES-R"
replace election_level = "District" if study_id == "on2003-OES-D"
replace election_level = "Regional" if study_id == "on2007-OES-R"
replace election_level = "Regional" if study_id == "on2011-Ipsos-R"
replace election_level = "District" if study_id == "on2011-Ipsos-D"
replace election_level = "Regional" if study_id == "on2014-Ipsos-R"
replace election_level = "District" if study_id == "on2014-Ipsos-D"
replace election_level = "National" if study_id == "pt2009-PVS-N1"
replace election_level = "National" if study_id == "pt2009-PVS-N2"
replace election_level = "Municipal" if study_id == "qc2017-CMES-M"
replace election_level = "Regional" if study_id == "rp2016-GLES-R"
replace election_level = "Regional" if study_id == "sn2014-GLES-R"
replace election_level = "Regional" if study_id == "sh2017-GLES-R"
replace election_level = "National" if study_id == "es2016-CIS-N"
replace election_level = "National" if study_id == "esA2019-CIS-N"
replace election_level = "National" if study_id == "esN2019-CIS-N"
replace election_level = "Regional" if study_id == "sk2020-SKPES-R"
replace election_level = "Regional" if study_id == "th2014-GLES-R"
replace election_level = "National" if study_id == "us1984-ANES-N"
replace election_level = "State" if study_id == "us1984-ANES-S"
replace election_level = "National" if study_id == "us1988-ANES-N"
replace election_level = "State" if study_id == "us1988-ANES-S"
replace election_level = "National" if study_id == "us1992-ANES-N"
replace election_level = "State" if study_id == "us1992-ANES-S"
replace election_level = "National" if study_id == "us1996-ANES-N"
replace election_level = "State" if study_id == "us1996-ANES-S"
replace election_level = "National" if study_id == "us2000-ANES-N"
replace election_level = "National" if study_id == "us2000-ANES-USH"
replace election_level = "National" if study_id == "us2000-ANES-USS"
replace election_level = "National" if study_id == "us2000-NAES-N"
replace election_level = "National" if study_id == "us2000-NAES-REP-P"
replace election_level = "National" if study_id == "us2000-NAES-DEM-P"
replace election_level = "National" if study_id == "us2004-ANES-N"
replace election_level = "State" if study_id == "us2004-ANES-S"
replace election_level = "National" if study_id == "us2004-NAES-N"
replace election_level = "National" if study_id == "us2004-NAES-DEM-P"
replace election_level = "National" if study_id == "us2008-ANES-N"
replace election_level = "State" if study_id == "us2008-ANES-S"
replace election_level = "National" if study_id == "us2008-NAES-N"
replace election_level = "National" if study_id == "us2008-NAES-REP-P"
replace election_level = "National" if study_id == "us2008-NAES-DEM-P"
replace election_level = "National" if study_id == "us2012-ANES-N"
replace election_level = "State" if study_id == "us2012-ANES-S"
replace election_level = "National" if study_id == "us2016-ANES-N"
replace election_level = "State" if study_id == "us2016-ANES-S"
replace election_level = "National" if study_id == "us2016-TAPS-N"
replace election_level = "National" if study_id == "us2016-TAPS-REP-P"
replace election_level = "National" if study_id == "us2016-TAPS-DEM-P"
replace election_level = "National" if study_id == "us2016-UAS-N"
replace election_level = "National" if study_id == "us2020-ANES-N"
replace election_level = "State" if study_id == "us2020-ANES-S"

gen election_system = " "

replace election_system = "Party list PR" if study_id == "at2013-AUTNES-N"
replace election_system = "Party list PR" if study_id == "at2017-AUTNES-N"
replace election_system = "MMP" if study_id == "bw2016-GLES-R"
replace election_system = "MMP" if study_id == "by2013-GLES-R"
replace election_system = "MMP" if study_id == "bb2014-GLES-R"
replace election_system = "FPTP" if study_id == "ca1988-CES-N"
replace election_system = "FPTP" if study_id == "ca1988-CES-D"
replace election_system = "FPTP" if study_id == "ca1993-CES-N"
replace election_system = "FPTP" if study_id == "ca1997-CES-N"
replace election_system = "FPTP" if study_id == "ca2000-CES-D"
replace election_system = "FPTP" if study_id == "ca2004-CES-N"
replace election_system = "FPTP" if study_id == "ca2004-CES-D"
replace election_system = "FPTP" if study_id == "ca2006-CES-N"
replace election_system = "FPTP" if study_id == "ca2006-CES-D"
replace election_system = "FPTP" if study_id == "ca2008-CES-N"
replace election_system = "FPTP" if study_id == "ca2008-CES-D"
replace election_system = "FPTP" if study_id == "ca2011-CES-N"
replace election_system = "FPTP" if study_id == "ca2011-CES-D"
replace election_system = "FPTP" if study_id == "ca2019-CES-N1"
replace election_system = "FPTP" if study_id == "ca2019-CES-N2"
replace election_system = "FPTP" if study_id == "ca2019-CES-D"
replace election_system = "FPTP" if study_id == "ca2011-Ipsos-N"
replace election_system = "FPTP" if study_id == "ca2011-Ipsos-D"
replace election_system = "FPTP" if study_id == "ca2015-Ipsos-N"
replace election_system = "FPTP" if study_id == "ca2015-Ipsos-D"
replace election_system = "MMP" if study_id == "de2002-GFES-N"
replace election_system = "MMP" if study_id == "de2009-GLES-N"
replace election_system = "FPTP" if study_id == "de2009-GLES-D"
replace election_system = "MMP" if study_id == "de2013-GLES-N"
replace election_system = "FPTP" if study_id == "de2013-GLES-D"
replace election_system = "MMP" if study_id == "de2017-GLES-N"
replace election_system = "FPTP" if study_id == "de2017-GLES-D"
replace election_system = "MMP" if study_id == "de2021-GLES-N"
replace election_system = "FPTP" if study_id == "de2021-GLES-D"
replace election_system = "FPTP" if study_id == "gb1964-BES-N"
replace election_system = "FPTP" if study_id == "gb1964-BES-D"
replace election_system = "FPTP" if study_id == "gb1987-BES-N"
replace election_system = "FPTP" if study_id == "gb2005-BES-N"
replace election_system = "FPTP" if study_id == "gb2005-BES-D"
replace election_system = "FPTP" if study_id == "gb2010-BES-N"
replace election_system = "FPTP" if study_id == "gb2010-BES-D"
replace election_system = "FPTP" if study_id == "gb2015-BES-D"
replace election_system = "FPTP" if study_id == "gb2017-BES-D"
replace election_system = "FPTP" if study_id == "gb2019-BES-D"
replace election_system = "MMP" if study_id == "he2013-GLES-R"
replace election_system = "Party list PR" if study_id == "il1992-INES-N"
replace election_system = "FPTP" if study_id == "il1996-INES-N1"
replace election_system = "Party list PR" if study_id == "il1996-INES-N2"
replace election_system = "Party list PR" if study_id == "il2003-INES-N"
replace election_system = "Party list PR" if study_id == "il2009-INES-N"
replace election_system = "Party list PR" if study_id == "il2015-INES-N"
replace election_system = "Party list PR" if study_id == "il2020-INES-N"
replace election_system = "Party list PR" if study_id == "il2021-INES-N"
replace election_system = "Party list PR" if study_id == "it2006-ITANES-N"
replace election_system = "MMP" if study_id == "ni2013-GLES-R"
replace election_system = "FPTP" if study_id == "mtl2017-CMES-M"
replace election_system = "MMP" if study_id == "mv2016-GLES-R"
replace election_system = "MMP" if study_id == "nz2002-NZES-N"
replace election_system = "MMP" if study_id == "nz2002-NZES-D"
replace election_system = "MMP" if study_id == "nw2012-GLES-R"
replace election_system = "MMP" if study_id == "nw2017-GLES-R"
replace election_system = "FPTP" if study_id == "on2003-OES-R"
replace election_system = "FPTP" if study_id == "on2003-OES-D"
replace election_system = "FPTP" if study_id == "on2007-OES-R"
replace election_system = "FPTP" if study_id == "on2011-Ipsos-R"
replace election_system = "FPTP" if study_id == "on2011-Ipsos-D"
replace election_system = "FPTP" if study_id == "on2014-Ipsos-R"
replace election_system = "FPTP" if study_id == "on2014-Ipsos-D"
replace election_system = "Party list PR" if study_id == "pt2009-PVS-N1"
replace election_system = "Party list PR" if study_id == "pt2009-PVS-N2"
replace election_system = "FPTP" if study_id == "qc2017-CMES-M"
replace election_system = "MMP" if study_id == "rp2016-GLES-R"
replace election_system = "MMP" if study_id == "sn2014-GLES-R"
replace election_system = "MMP" if study_id == "sh2017-GLES-R"
replace election_system = "Party list PR" if study_id == "es2016-CIS-N"
replace election_system = "Party list PR" if study_id == "esA2019-CIS-N"
replace election_system = "Party list PR" if study_id == "esN2019-CIS-N"
replace election_system = "MMP" if study_id == "th2014-GLES-R"
replace election_system = "FPTP" if study_id == "sk2020-SKPES-R"
replace election_system = "Electoral College" if study_id == "us1984-ANES-N"
replace election_system = "FPTP" if study_id == "us1984-ANES-S"
replace election_system = "Electoral College" if study_id == "us1988-ANES-N"
replace election_system = "FPTP" if study_id == "us1988-ANES-S"
replace election_system = "Electoral College" if study_id == "us1992-ANES-N"
replace election_system = "FPTP" if study_id == "us1992-ANES-S"
replace election_system = "Electoral College" if study_id == "us1996-ANES-N"
replace election_system = "FPTP" if study_id == "us1996-ANES-S"
replace election_system = "Electoral College" if study_id == "us2000-ANES-N"
replace election_system = "FPTP" if study_id == "us2000-ANES-USH"
replace election_system = "FPTP" if study_id == "us2000-ANES-USS"
replace election_system = "Electoral College" if study_id == "us2000-NAES-N"
replace election_system = "Delegates" if study_id == "us2000-NAES-REP-P"
replace election_system = "Delegates" if study_id == "us2000-NAES-DEM-P"
replace election_system = "Electoral College" if study_id == "us2004-ANES-N"
replace election_system = "FPTP" if study_id == "us2004-ANES-S"
replace election_system = "Electoral College" if study_id == "us2004-NAES-N"
replace election_system = "Delegates" if study_id == "us2004-NAES-DEM-P"
replace election_system = "Electoral College" if study_id == "us2008-ANES-N"
replace election_system = "FPTP" if study_id == "us2008-ANES-S"
replace election_system = "Electoral College" if study_id == "us2008-NAES-N"
replace election_system = "Delegates" if study_id == "us2008-NAES-REP-P"
replace election_system = "Delegates" if study_id == "us2008-NAES-DEM-P"
replace election_system = "Electoral College" if study_id == "us2012-ANES-N"
replace election_system = "FPTP" if study_id == "us2012-ANES-S"
replace election_system = "Electoral College" if study_id == "us2016-ANES-N"
replace election_system = "FPTP" if study_id == "us2016-ANES-S"
replace election_system = "Electoral College" if study_id == "us2016-TAPS-N"
replace election_system = "Electoral College" if study_id == "us2016-UAS-N"
replace election_system = "Delegates" if study_id == "us2016-TAPS-REP-P"
replace election_system = "Delegates" if study_id == "us2016-TAPS-DEM-P"
replace election_system = "Electoral College" if study_id == "us2020-ANES-N"
replace election_system = "FPTP" if study_id == "us2020-ANES-S"

gen survey_type = " "

replace survey_type = "FTF CAPI / Phone CATI" if study_id == "at2013-AUTNES-N"
replace survey_type = "Phone CATI / CAWI" if study_id == "at2017-AUTNES-N"
replace survey_type = "Self-administered questionnaire: Web-based (CAWI)" if study_id == "bw2016-GLES-R"
replace survey_type = "Self-administered questionnaire: Web-based (CAWI)" if study_id == "by2013-GLES-R"
replace survey_type = "Self-administered questionnaire: Web-based (CAWI)" if study_id == "bb2014-GLES-R"
replace survey_type = "Phone CATI / Mail" if study_id == "ca1988-CES-N"
replace survey_type = "Phone CATI / Mail" if study_id == "ca1988-CES-D"
replace survey_type = "Phone CATI / Mail" if study_id == "ca1993-CES-N"
replace survey_type = "Phone CATI / Mail" if study_id == "ca1997-CES-N"
replace survey_type = "Phone CATI / Mail" if study_id == "ca2000-CES-D"
replace survey_type = "Phone CATI / Mail" if study_id == "ca2004-CES-N"
replace survey_type = "Phone CATI / Mail" if study_id == "ca2004-CES-D"
replace survey_type = "Phone CATI" if study_id == "ca2006-CES-N"
replace survey_type = "Phone CATI" if study_id == "ca2006-CES-D"
replace survey_type = "Phone CATI / Mail" if study_id == "ca2008-CES-N"
replace survey_type = "Phone CATI / Mail" if study_id == "ca2008-CES-D"
replace survey_type = "Phone CATI / Mail / Online" if study_id == "ca2011-CES-N"
replace survey_type = "Phone CATI / Mail / Online" if study_id == "ca2011-CES-D"
replace survey_type = "Online" if study_id == "ca2019-CES-N1"
replace survey_type = "Online" if study_id == "ca2019-CES-N2"
replace survey_type = "Online" if study_id == "ca2019-CES-D"
replace survey_type = "Online" if study_id == "ca2011-Ipsos-N"
replace survey_type = "Online" if study_id == "ca2011-Ipsos-D"
replace survey_type = "Online" if study_id == "ca2015-Ipsos-N"
replace survey_type = "Online" if study_id == "ca2015-Ipsos-D"
replace survey_type = "FTF CAPI / CAMI" if study_id == "de2002-GFES-N"
replace survey_type = "FTF CAPI / CAMI" if study_id == "de2009-GLES-N"
replace survey_type = "FTF CAPI / CAMI" if study_id == "de2009-GLES-D"
replace survey_type = "FTF CAPI / CAMI" if study_id == "de2013-GLES-N"
replace survey_type = "FTF CAPI / CAMI" if study_id == "de2013-GLES-D"
replace survey_type = "FTF CAPI / CAMI" if study_id == "de2017-GLES-N"
replace survey_type = "FTF CAPI / CAMI" if study_id == "de2017-GLES-D"
replace survey_type = "CAWI / PAPI" if study_id == "de2021-GLES-N"
replace survey_type = "CAWI / PAPI" if study_id == "de2021-GLES-D"
replace survey_type = "FTF" if study_id == "gb1964-BES-N"
replace survey_type = "FTF" if study_id == "gb1964-BES-D"
replace survey_type = "FTF / Phone" if study_id == "gb1987-BES-N"
replace survey_type = "FTF / Phone / Mail" if study_id == "gb2005-BES-N"
replace survey_type = "FTF / Phone / Mail" if study_id == "gb2005-BES-D"
replace survey_type = "FTF CAPI / Mail" if study_id == "gb2010-BES-N"
replace survey_type = "FTF CAPI / Mail" if study_id == "gb2010-BES-D"
replace survey_type = "Online" if study_id == "gb2015-BES-D"
replace survey_type = "Online" if study_id == "gb2017-BES-D"
replace survey_type = "Online" if study_id == "gb2019-BES-D"
replace survey_type = "Self-administered questionnaire: Web-based (CAWI)" if study_id == "he2013-GLES-R"
replace survey_type = "FTF" if study_id == "il1992-INES-N"
replace survey_type = "FTF" if study_id == "il1996-INES-N1"
replace survey_type = "FTF" if study_id == "il1996-INES-N2"
replace survey_type = "Phone" if study_id == "il2003-INES-N"
replace survey_type = "Phone" if study_id == "il2009-INES-N"
replace survey_type = "Phone" if study_id == "il2015-INES-N"
replace survey_type = "Phone" if study_id == "il2020-INES-N"
replace survey_type = "Phone / Online" if study_id == "il2021-INES-N"
replace survey_type = "FTF CAPI" if study_id == "it2006-ITANES-N"
replace survey_type = "Self-administered questionnaire: Web-based (CAWI)" if study_id == "ni2013-GLES-R"
replace survey_type = " " if study_id == "mtl2017-CMES-M"
replace survey_type = "Self-administered questionnaire: Web-based (CAWI)" if study_id == "mv2016-GLES-R"
replace survey_type = "Phone / Mail" if study_id == "nz2002-NZES-N"
replace survey_type = "Phone / Mail" if study_id == "nz2002-NZES-D"
replace survey_type = "Self-administered questionnaire: Web-based (CAWI)" if study_id == "nw2012-GLES-R"
replace survey_type = "Self-administered questionnaire: Web-based (CAWI)" if study_id == "nw2017-GLES-R"
replace survey_type = "Phone" if study_id == "on2003-OES-R"
replace survey_type = "Phone" if study_id == "on2003-OES-D"
replace survey_type = "Phone" if study_id == "on2007-OES-R"
replace survey_type = "Online" if study_id == "on2011-Ipsos-R"
replace survey_type = "Online" if study_id == "on2011-Ipsos-D"
replace survey_type = "Online" if study_id == "on2014-Ipsos-R"
replace survey_type = "Online" if study_id == "on2014-Ipsos-D"
replace survey_type = "FTF" if study_id == "pt2009-PVS-N1"
replace survey_type = "FTF" if study_id == "pt2009-PVS-N2"
replace survey_type = " " if study_id == "qc2017-CMES-M"
replace survey_type = "Self-administered questionnaire: Web-based (CAWI)" if study_id == "rp2016-GLES-R"
replace survey_type = "Self-administered questionnaire: Web-based (CAWI)" if study_id == "sn2014-GLES-R"
replace survey_type = "Self-administered questionnaire: Web-based (CAWI)" if study_id == "sh2017-GLES-R"
replace survey_type = "FTF" if study_id == "es2016-CIS-N"
replace survey_type = "FTF" if study_id == "esA2019-CIS-N"
replace survey_type = "FTF" if study_id == "esN2019-CIS-N"
replace survey_type = "Online" if study_id == "sk2020-SKPES-R"
replace survey_type = "Self-administered questionnaire: Web-based (CAWI)" if study_id == "th2014-GLES-R"
replace survey_type = "FTF / Phone" if study_id == "us1984-ANES-N"
replace survey_type = "FTF / Phone" if study_id == "us1984-ANES-S"
replace survey_type = "FTF" if study_id == "us1988-ANES-N"
replace survey_type = "FTF" if study_id == "us1988-ANES-S"
replace survey_type = "FTF / Phone" if study_id == "us1992-ANES-N"
replace survey_type = "FTF / Phone" if study_id == "us1992-ANES-S"
replace survey_type = "FTF / Phone" if study_id == "us1996-ANES-N"
replace survey_type = "FTF / Phone" if study_id == "us1996-ANES-S"
replace survey_type = "FTF CAPI / Phone CATI" if study_id == "us2000-ANES-N"
replace survey_type = "FTF CAPI / Phone CATI" if study_id == "us2000-ANES-USH"
replace survey_type = "FTF CAPI / Phone CATI" if study_id == "us2000-ANES-USS"
replace survey_type = "Phone" if study_id == "us2000-NAES-N"
replace survey_type = "Phone" if study_id == "us2000-NAES-REP-P"
replace survey_type = "Phone" if study_id == "us2000-NAES-DEM-P"
replace survey_type = "FTF CAPI" if study_id == "us2004-ANES-N"
replace survey_type = "FTF CAPI" if study_id == "us2004-ANES-S"
replace survey_type = "Phone" if study_id == "us2004-NAES-N"
replace survey_type = "Phone" if study_id == "us2004-NAES-DEM-P"
replace survey_type = "FTF CAPI / ACASI" if study_id == "us2008-ANES-N"
replace survey_type = "FTF CAPI / ACASI" if study_id == "us2008-ANES-S"
replace survey_type = "Phone" if study_id == "us2008-NAES-N"
replace survey_type = "Phone" if study_id == "us2008-NAES-REP-P"
replace survey_type = "Phone" if study_id == "us2008-NAES-DEM-P"
replace survey_type = "FTF CAPI / CASI" if study_id == "us2012-ANES-N"
replace survey_type = "FTF CAPI / CASI" if study_id == "us2012-ANES-S"
replace survey_type = "FTF CAPI / CASI" if study_id == "us2016-ANES-N"
replace survey_type = "FTF CAPI / CASI" if study_id == "us2016-ANES-S"
replace survey_type = "Online" if study_id == "us2016-TAPS-N"
replace survey_type = "Online" if study_id == "us2016-TAPS-REP-P"
replace survey_type = "Online" if study_id == "us2016-TAPS-DEM-P"
replace survey_type = " " if study_id == "us2016-UAS-N"
replace survey_type = "Web / Phone / Video" if study_id == "us2020-ANES-N"
replace survey_type = "Web / Phone / Video" if study_id == "us2020-ANES-S"

gen wt_strategy = " "

replace wt_strategy = "No" if study_id == "at2013-AUTNES-N"
replace wt_strategy = "No" if study_id == "at2017-AUTNES-N"
replace wt_strategy = "No" if study_id == "bw2016-GLES-R"
replace wt_strategy = "No" if study_id == "by2013-GLES-R"
replace wt_strategy = "No" if study_id == "bb2014-GLES-R"
replace wt_strategy = "No" if study_id == "ca1988-CES-N"
replace wt_strategy = "No" if study_id == "ca1988-CES-D"
replace wt_strategy = "No" if study_id == "ca1993-CES-N"
replace wt_strategy = "No" if study_id == "ca1997-CES-N"
replace wt_strategy = "No" if study_id == "ca2000-CES-D"
replace wt_strategy = "No" if study_id == "ca2004-CES-N"
replace wt_strategy = "No" if study_id == "ca2004-CES-D"
replace wt_strategy = "No" if study_id == "ca2006-CES-N"
replace wt_strategy = "No" if study_id == "ca2006-CES-D"
replace wt_strategy = "No" if study_id == "ca2008-CES-N"
replace wt_strategy = "No" if study_id == "ca2008-CES-D"
replace wt_strategy = "No" if study_id == "ca2011-CES-N"
replace wt_strategy = "No" if study_id == "ca2011-CES-D"
replace wt_strategy = "No" if study_id == "ca2019-CES-N1"
replace wt_strategy = "No" if study_id == "ca2019-CES-N2"
replace wt_strategy = "No" if study_id == "ca2019-CES-D"
replace wt_strategy = "Yes" if study_id == "ca2011-Ipsos-N"
replace wt_strategy = "Yes" if study_id == "ca2011-Ipsos-D"
replace wt_strategy = "Yes" if study_id == "ca2015-Ipsos-N"
replace wt_strategy = "Yes" if study_id == "ca2015-Ipsos-D"
replace wt_strategy = "No" if study_id == "de2002-GFES-N"
replace wt_strategy = "No" if study_id == "de2009-GLES-N"
replace wt_strategy = "No" if study_id == "de2009-GLES-D"
replace wt_strategy = "No" if study_id == "de2013-GLES-N"
replace wt_strategy = "No" if study_id == "de2013-GLES-D"
replace wt_strategy = "No" if study_id == "de2017-GLES-N"
replace wt_strategy = "No" if study_id == "de2017-GLES-D"
replace wt_strategy = "No" if study_id == "de2021-GLES-N"
replace wt_strategy = "No" if study_id == "de2021-GLES-D"
replace wt_strategy = "Yes" if study_id == "gb1964-BES-N"
replace wt_strategy = "Yes" if study_id == "gb1964-BES-D"
replace wt_strategy = "No" if study_id == "gb1987-BES-N"
replace wt_strategy = "No" if study_id == "gb2005-BES-N"
replace wt_strategy = "No" if study_id == "gb2005-BES-D"
replace wt_strategy = "No" if study_id == "gb2010-BES-N"
replace wt_strategy = "No" if study_id == "gb2010-BES-D"
replace wt_strategy = "No" if study_id == "gb2015-BES-D"
replace wt_strategy = "No" if study_id == "gb2017-BES-D"
replace wt_strategy = "No" if study_id == "gb2019-BES-D"
replace wt_strategy = "No" if study_id == "he2013-GLES-R"
replace wt_strategy = "No" if study_id == "il1992-INES-N"
replace wt_strategy = "No" if study_id == "il1996-INES-N1"
replace wt_strategy = "No" if study_id == "il1996-INES-N2"
replace wt_strategy = "No" if study_id == "il2003-INES-N"
replace wt_strategy = "No" if study_id == "il2009-INES-N"
replace wt_strategy = "No" if study_id == "il2015-INES-N"
replace wt_strategy = "No" if study_id == "il2020-INES-N"
replace wt_strategy = "No" if study_id == "il2021-INES-N"
replace wt_strategy = "No" if study_id == "it2006-ITANES-N"
replace wt_strategy = "No" if study_id == "ni2013-GLES-R"
replace wt_strategy = "No" if study_id == "mtl2017-CMES-M"
replace wt_strategy = "No" if study_id == "mv2016-GLES-R"
replace wt_strategy = "No" if study_id == "nz2002-NZES-N"
replace wt_strategy = "No" if study_id == "nz2002-NZES-D"
replace wt_strategy = "No" if study_id == "nw2012-GLES-R"
replace wt_strategy = "No" if study_id == "nw2017-GLES-R"
replace wt_strategy = "No" if study_id == "on2003-OES-R"
replace wt_strategy = "No" if study_id == "on2003-OES-D"
replace wt_strategy = "No" if study_id == "on2007-OES-R"
replace wt_strategy = "Yes" if study_id == "on2011-Ipsos-R"
replace wt_strategy = "Yes" if study_id == "on2011-Ipsos-D"
replace wt_strategy = "Yes" if study_id == "on2014-Ipsos-R"
replace wt_strategy = "Yes" if study_id == "on2014-Ipsos-D"
replace wt_strategy = "Yes" if study_id == "pt2009-PVS-N1"
replace wt_strategy = "Yes" if study_id == "pt2009-PVS-N2"
replace wt_strategy = "No" if study_id == "qc2017-CMES-M"
replace wt_strategy = "No" if study_id == "rp2016-GLES-R"
replace wt_strategy = "No" if study_id == "sn2014-GLES-R"
replace wt_strategy = "No" if study_id == "sh2017-GLES-R"
replace wt_strategy = "No" if study_id == "es2016-CIS-N"
replace wt_strategy = "No" if study_id == "esA2019-CIS-N"
replace wt_strategy = "No" if study_id == "esN2019-CIS-N"
replace wt_strategy = "No" if study_id == "sk2020-SKPES-R"
replace wt_strategy = "No" if study_id == "th2014-GLES-R"
replace wt_strategy = "No" if study_id == "us1984-ANES-N"
replace wt_strategy = "No" if study_id == "us1984-ANES-S"
replace wt_strategy = "No" if study_id == "us1988-ANES-N"
replace wt_strategy = "No" if study_id == "us1988-ANES-S"
replace wt_strategy = "No" if study_id == "us1992-ANES-N"
replace wt_strategy = "No" if study_id == "us1992-ANES-S"
replace wt_strategy = "No" if study_id == "us1996-ANES-N"
replace wt_strategy = "No" if study_id == "us1996-ANES-S"
replace wt_strategy = "No" if study_id == "us2000-ANES-N"
replace wt_strategy = "No" if study_id == "us2000-ANES-USH"
replace wt_strategy = "No" if study_id == "us2000-ANES-USS"
replace wt_strategy = "No" if study_id == "us2000-NAES-N"
replace wt_strategy = "No" if study_id == "us2000-NAES-REP-P"
replace wt_strategy = "No" if study_id == "us2000-NAES-DEM-P"
replace wt_strategy = "No" if study_id == "us2004-ANES-N"
replace wt_strategy = "No" if study_id == "us2004-ANES-S"
replace wt_strategy = "No" if study_id == "us2004-NAES-N"
replace wt_strategy = "No" if study_id == "us2004-NAES-DEM-P"
replace wt_strategy = "No" if study_id == "us2008-ANES-N"
replace wt_strategy = "No" if study_id == "us2008-ANES-S"
replace wt_strategy = "No" if study_id == "us2008-NAES-N"
replace wt_strategy = "No" if study_id == "us2008-NAES-REP-P"
replace wt_strategy = "No" if study_id == "us2008-NAES-DEM-P"
replace wt_strategy = "No" if study_id == "us2012-ANES-N"
replace wt_strategy = "No" if study_id == "us2012-ANES-S"
replace wt_strategy = "No" if study_id == "us2016-ANES-N"
replace wt_strategy = "No" if study_id == "us2016-ANES-S"
replace wt_strategy = "No" if study_id == "us2016-TAPS-N"
replace wt_strategy = "No" if study_id == "us2016-TAPS-REP-P"
replace wt_strategy = "No" if study_id == "us2016-TAPS-DEM-P"
replace wt_strategy = "No" if study_id == "us2016-UAS-N"
replace wt_strategy = "No" if study_id == "us2020-ANES-N"
replace wt_strategy = "No" if study_id == "us2020-ANES-S"

gen region = " "

replace region = "Austria" if study_id == "at2013-AUTNES-N"
replace region = "Austria" if study_id == "at2017-AUTNES-N"
replace region = "Baden-Württemberg (Germany)" if study_id == "bw2016-GLES-R"
replace region = "Bavaria (Germany)" if study_id == "by2013-GLES-R"
replace region = "Brandenburg (Germany)" if study_id == "bb2014-GLES-R"
replace region = "Canada" if study_id == "ca1988-CES-N"
replace region = "Canada" if study_id == "ca1988-CES-D"
replace region = "Canada" if study_id == "ca1993-CES-N"
replace region = "Canada" if study_id == "ca1997-CES-N"
replace region = "Canada" if study_id == "ca2000-CES-D"
replace region = "Canada" if study_id == "ca2004-CES-N"
replace region = "Canada" if study_id == "ca2004-CES-D"
replace region = "Canada" if study_id == "ca2006-CES-N"
replace region = "Canada" if study_id == "ca2006-CES-D"
replace region = "Canada" if study_id == "ca2008-CES-N"
replace region = "Canada" if study_id == "ca2008-CES-D"
replace region = "Canada" if study_id == "ca2011-CES-N"
replace region = "Canada" if study_id == "ca2011-CES-D"
replace region = "Canada" if study_id == "ca2019-CES-N1"
replace region = "Canada" if study_id == "ca2019-CES-N2"
replace region = "Canada" if study_id == "ca2019-CES-D"
replace region = "Canada" if study_id == "ca2011-Ipsos-N"
replace region = "Canada" if study_id == "ca2011-Ipsos-D"
replace region = "Canada" if study_id == "ca2015-Ipsos-N"
replace region = "Canada" if study_id == "ca2015-Ipsos-D"
replace region = "Germany" if study_id == "de2002-GFES-N"
replace region = "Germany" if study_id == "de2009-GLES-N"
replace region = "Germany" if study_id == "de2009-GLES-D"
replace region = "Germany" if study_id == "de2013-GLES-N"
replace region = "Germany" if study_id == "de2013-GLES-D"
replace region = "Germany" if study_id == "de2017-GLES-N"
replace region = "Germany" if study_id == "de2017-GLES-D"
replace region = "Germany" if study_id == "de2021-GLES-N"
replace region = "Germany" if study_id == "de2021-GLES-D"
replace region = "Great Britain" if study_id == "gb1964-BES-N"
replace region = "Great Britain" if study_id == "gb1964-BES-D"
replace region = "Great Britain" if study_id == "gb1987-BES-N"
replace region = "Great Britain" if study_id == "gb2005-BES-N"
replace region = "Great Britain" if study_id == "gb2005-BES-D"
replace region = "Great Britain" if study_id == "gb2010-BES-N"
replace region = "Great Britain" if study_id == "gb2010-BES-D"
replace region = "Great Britain" if study_id == "gb2015-BES-D"
replace region = "Great Britain" if study_id == "gb2017-BES-D"
replace region = "Great Britain" if study_id == "gb2019-BES-D"
replace region = "Hesse (Germany)" if study_id == "he2013-GLES-R"
replace region = "Israel" if study_id == "il1992-INES-N"
replace region = "Israel" if study_id == "il1996-INES-N1"
replace region = "Israel" if study_id == "il1996-INES-N2"
replace region = "Israel" if study_id == "il2003-INES-N"
replace region = "Israel" if study_id == "il2009-INES-N"
replace region = "Israel" if study_id == "il2015-INES-N"
replace region = "Israel" if study_id == "il2020-INES-N"
replace region = "Israel" if study_id == "il2021-INES-N"
replace region = "Italy" if study_id == "it2006-ITANES-N"
replace region = "Lower Saxony (Germany)" if study_id == "ni2013-GLES-R"
replace region = "Montreal (Canada)" if study_id == "mtl2017-CMES-M"
replace region = "Mecklenburg-Western Pomerania (Germany)" if study_id == "mv2016-GLES-R"
replace region = "New Zealand" if study_id == "nz2002-NZES-N"
replace region = "New Zealand" if study_id == "nz2002-NZES-D"
replace region = "North Rhine-Westphalia (Germany)" if study_id == "nw2012-GLES-R"
replace region = "North Rhine-Westphalia (Germany)" if study_id == "nw2017-GLES-R"
replace region = "Ontario (Canada)" if study_id == "on2003-OES-R"
replace region = "Ontario (Canada)" if study_id == "on2003-OES-D"
replace region = "Ontario (Canada)" if study_id == "on2007-OES-R"
replace region = "Ontario (Canada)" if study_id == "on2011-Ipsos-R"
replace region = "Ontario (Canada)" if study_id == "on2011-Ipsos-D"
replace region = "Ontario (Canada)" if study_id == "on2014-Ipsos-R"
replace region = "Ontario (Canada)" if study_id == "on2014-Ipsos-D"
replace region = "Portugal" if study_id == "pt2009-PVS-N1"
replace region = "Portugal" if study_id == "pt2009-PVS-N2"
replace region = "Quebec City (Canada)" if study_id == "qc2017-CMES-M"
replace region = "Rhineland-Palatinate (Germany)" if study_id == "rp2016-GLES-R"
replace region = "Saxony (Germany)" if study_id == "sn2014-GLES-R"
replace region = "Schleswig-Holstein (Germany)" if study_id == "sh2017-GLES-R"
replace region = "Spain" if study_id == "es2016-CIS-N"
replace region = "Spain" if study_id == "esA2019-CIS-N"
replace region = "Spain" if study_id == "esN2019-CIS-N"
replace region = "Saskatchewan (Canada)" if study_id == "sk2020-SKPES-R"
replace region = "Thuringia (Germany)" if study_id == "th2014-GLES-R"
replace region = "United States" if study_id == "us1984-ANES-N"
replace region = "United States" if study_id == "us1984-ANES-S"
replace region = "United States" if study_id == "us1988-ANES-N"
replace region = "United States" if study_id == "us1988-ANES-S"
replace region = "United States" if study_id == "us1992-ANES-N"
replace region = "United States" if study_id == "us1992-ANES-S"
replace region = "United States" if study_id == "us1996-ANES-N"
replace region = "United States" if study_id == "us1996-ANES-S"
replace region = "United States" if study_id == "us2000-ANES-N"
replace region = "United States" if study_id == "us2000-ANES-USH"
replace region = "United States" if study_id == "us2000-ANES-USS"
replace region = "United States" if study_id == "us2000-NAES-N"
replace region = "United States" if study_id == "us2000-NAES-REP-P"
replace region = "United States" if study_id == "us2000-NAES-DEM-P"
replace region = "United States" if study_id == "us2004-ANES-N"
replace region = "United States" if study_id == "us2004-ANES-S"
replace region = "United States" if study_id == "us2004-NAES-N"
replace region = "United States" if study_id == "us2004-NAES-DEM-P"
replace region = "United States" if study_id == "us2008-ANES-N"
replace region = "United States" if study_id == "us2008-ANES-S"
replace region = "United States" if study_id == "us2008-NAES-N"
replace region = "United States" if study_id == "us2008-NAES-REP-P"
replace region = "United States" if study_id == "us2008-NAES-DEM-P"
replace region = "United States" if study_id == "us2012-ANES-N"
replace region = "United States" if study_id == "us2012-ANES-S"
replace region = "United States" if study_id == "us2016-ANES-N"
replace region = "United States" if study_id == "us2016-ANES-S"
replace region = "United States" if study_id == "us2016-TAPS-N"
replace region = "United States" if study_id == "us2016-UAS-N"
replace region = "United States" if study_id == "us2016-TAPS-REP-P"
replace region = "United States" if study_id == "us2016-TAPS-DEM-P"
replace region = "United States" if study_id == "us2020-ANES-N"
replace region = "United States" if study_id == "us2020-ANES-S"

gen district_name = ""

replace district_name =	"Bonavista--Trinity--Conception" if district_code == 10001 & election == "2000 Canadian federal election"
replace district_name =	"Burin--St. George's" if district_code == 10002 & election == "2000 Canadian federal election"
replace district_name =	"Gander--Grand Falls" if district_code == 10003 & election == "2000 Canadian federal election"
replace district_name =	"Humber--St. Barbe--Baie Verte" if district_code == 10004 & election == "2000 Canadian federal election"
replace district_name =	"Labrador" if district_code == 10005 & election == "2000 Canadian federal election"
replace district_name =	"St. John's East" if district_code == 10006 & election == "2000 Canadian federal election"
replace district_name =	"St. John's West" if district_code == 10007 & election == "2000 Canadian federal election"
replace district_name =	"Cardigan" if district_code == 11001 & election == "2000 Canadian federal election"
replace district_name =	"Egmont" if district_code == 11002 & election == "2000 Canadian federal election"
replace district_name =	"Hillsborough" if district_code == 11003 & election == "2000 Canadian federal election"
replace district_name =	"Malpeque" if district_code == 11004 & election == "2000 Canadian federal election"
replace district_name =	"Bras d'Or" if district_code == 12001 & election == "2000 Canadian federal election"
replace district_name =	"Cumberland--Colchester" if district_code == 12002 & election == "2000 Canadian federal election"
replace district_name =	"Dartmouth" if district_code == 12003 & election == "2000 Canadian federal election"
replace district_name =	"Halifax" if district_code == 12004 & election == "2000 Canadian federal election"
replace district_name =	"Halifax West" if district_code == 12005 & election == "2000 Canadian federal election"
replace district_name =	"Kings--Hants" if district_code == 12006 & election == "2000 Canadian federal election"
replace district_name =	"Pictou--Antigonish--Guysborough" if district_code == 12007 & election == "2000 Canadian federal election"
replace district_name =	"Sackville--Eastern Shore" if district_code == 12008 & election == "2000 Canadian federal election"
replace district_name =	"South Shore" if district_code == 12009 & election == "2000 Canadian federal election"
replace district_name =	"Sydney--Victoria" if district_code == 12010 & election == "2000 Canadian federal election"
replace district_name =	"West Nova" if district_code == 12011 & election == "2000 Canadian federal election"
replace district_name =	"Acadie--Bathurst" if district_code == 13001 & election == "2000 Canadian federal election"
replace district_name =	"Beausejour--Petitcodiac" if district_code == 13002 & election == "2000 Canadian federal election"
replace district_name =	"Charlotte" if district_code == 13003 & election == "2000 Canadian federal election"
replace district_name =	"Fredericton" if district_code == 13004 & election == "2000 Canadian federal election"
replace district_name =	"Fundy--Royal" if district_code == 13005 & election == "2000 Canadian federal election"
replace district_name =	"Madawaska--Restigouche" if district_code == 13006 & election == "2000 Canadian federal election"
replace district_name =	"Miramichi" if district_code == 13007 & election == "2000 Canadian federal election"
replace district_name =	"Moncton" if district_code == 13008 & election == "2000 Canadian federal election"
replace district_name =	"Saint John" if district_code == 13009 & election == "2000 Canadian federal election"
replace district_name =	"Tobique--Mactaquac" if district_code == 13010 & election == "2000 Canadian federal election"
replace district_name =	"Abitibi" if district_code == 24001 & election == "2000 Canadian federal election"
replace district_name =	"Ahuntsic" if district_code == 24002 & election == "2000 Canadian federal election"
replace district_name =	"Anjou--RiviÞre-des-Prairies" if district_code == 24003 & election == "2000 Canadian federal election"
replace district_name =	"Argenteuil--Papineau" if district_code == 24004 & election == "2000 Canadian federal election"
replace district_name =	"Beauce" if district_code == 24005 & election == "2000 Canadian federal election"
replace district_name =	"Beauharnois--Salaberry" if district_code == 24006 & election == "2000 Canadian federal election"
replace district_name =	"Beauport--Montmorency--Orleans" if district_code == 24007 & election == "2000 Canadian federal election"
replace district_name =	"Bellechasse--Etchemins--Montmagny--L'Islet" if district_code == 24008 & election == "2000 Canadian federal election"
replace district_name =	"Berthier--Montcalm" if district_code == 24009 & election == "2000 Canadian federal election"
replace district_name =	"Bourassa" if district_code == 24010 & election == "2000 Canadian federal election"
replace district_name =	"Brome--Missisquoi" if district_code == 24011 & election == "2000 Canadian federal election"
replace district_name =	"Brossard--La Prairie" if district_code == 24012 & election == "2000 Canadian federal election"
replace district_name =	"Chambly" if district_code == 24013 & election == "2000 Canadian federal election"
replace district_name =	"Champlain" if district_code == 24014 & election == "2000 Canadian federal election"
replace district_name =	"Charlesbourg" if district_code == 24015 & election == "2000 Canadian federal election"
replace district_name =	"Charlevoix" if district_code == 24016 & election == "2000 Canadian federal election"
replace district_name =	"Chateauguay" if district_code == 24017 & election == "2000 Canadian federal election"
replace district_name =	"Chicoutimi" if district_code == 24018 & election == "2000 Canadian federal election"
replace district_name =	"Compton--Stanstead" if district_code == 24019 & election == "2000 Canadian federal election"
replace district_name =	"Drummond" if district_code == 24020 & election == "2000 Canadian federal election"
replace district_name =	"Frontenac--Megantic" if district_code == 24021 & election == "2000 Canadian federal election"
replace district_name =	"Bonaventure--Gaspe--Iles-de-la-Madeleine--Pabok" if district_code == 24022 & election == "2000 Canadian federal election"
replace district_name =	"Gatineau" if district_code == 24023 & election == "2000 Canadian federal election"
replace district_name =	"Hochelaga--Maisonneuve" if district_code == 24024 & election == "2000 Canadian federal election"
replace district_name =	"Hull--Aylmer" if district_code == 24025 & election == "2000 Canadian federal election"
replace district_name =	"Joliette" if district_code == 24026 & election == "2000 Canadian federal election"
replace district_name =	"Jonquiere" if district_code == 24027 & election == "2000 Canadian federal election"
replace district_name =	"Kamouraska--RiviÞre-du-Loup--Temiscouata--Les Basques" if district_code == 24028 & election == "2000 Canadian federal election"
replace district_name =	"Notre-Dame-de-Grace--Lachine" if district_code == 24029 & election == "2000 Canadian federal election"
replace district_name =	"Lac-Saint-Jean" if district_code == 24030 & election == "2000 Canadian federal election"
replace district_name =	"Lac-Saint-Louis" if district_code == 24031 & election == "2000 Canadian federal election"
replace district_name =	"LaSalle--Emard" if district_code == 24032 & election == "2000 Canadian federal election"
replace district_name =	"Laurentides" if district_code == 24033 & election == "2000 Canadian federal election"
replace district_name =	"Laurier--Sainte-Marie" if district_code == 24034 & election == "2000 Canadian federal election"
replace district_name =	"Laval Centre" if district_code == 24035 & election == "2000 Canadian federal election"
replace district_name =	"Laval East" if district_code == 24036 & election == "2000 Canadian federal election"
replace district_name =	"Laval West" if district_code == 24037 & election == "2000 Canadian federal election"
replace district_name =	"Levis" if district_code == 24038 & election == "2000 Canadian federal election"
replace district_name =	"Longueuil" if district_code == 24039 & election == "2000 Canadian federal election"
replace district_name =	"Lotbiniere" if district_code == 24040 & election == "2000 Canadian federal election"
replace district_name =	"Louis-Hebert" if district_code == 24041 & election == "2000 Canadian federal election"
replace district_name =	"Manicouagan" if district_code == 24042 & election == "2000 Canadian federal election"
replace district_name =	"Matapedia--Matane" if district_code == 24043 & election == "2000 Canadian federal election"
replace district_name =	"Mercier" if district_code == 24044 & election == "2000 Canadian federal election"
replace district_name =	"Mount Royal" if district_code == 24045 & election == "2000 Canadian federal election"
replace district_name =	"Outremont" if district_code == 24046 & election == "2000 Canadian federal election"
replace district_name =	"Papineau--Saint-Denis" if district_code == 24047 & election == "2000 Canadian federal election"
replace district_name =	"Pierrefonds--Dollard" if district_code == 24048 & election == "2000 Canadian federal election"
replace district_name =	"Pontiac--Gatineau--Labelle" if district_code == 24049 & election == "2000 Canadian federal election"
replace district_name =	"Portneuf" if district_code == 24050 & election == "2000 Canadian federal election"
replace district_name =	"Quebec" if district_code == 24051 & election == "2000 Canadian federal election"
replace district_name =	"Quebec East" if district_code == 24052 & election == "2000 Canadian federal election"
replace district_name =	"Repentigny" if district_code == 24053 & election == "2000 Canadian federal election"
replace district_name =	"Richelieu" if district_code == 24054 & election == "2000 Canadian federal election"
replace district_name =	"Richmond--Arthabaska" if district_code == 24055 & election == "2000 Canadian federal election"
replace district_name =	"Rimouski--Mitis" if district_code == 24056 & election == "2000 Canadian federal election"
replace district_name =	"Roberval" if district_code == 24057 & election == "2000 Canadian federal election"
replace district_name =	"Rosemont" if district_code == 24058 & election == "2000 Canadian federal election"
replace district_name =	"Temiscamingue" if district_code == 24059 & election == "2000 Canadian federal election"
replace district_name =	"Saint-Eustache--Sainte-Therese" if district_code == 24060 & election == "2000 Canadian federal election"
replace district_name =	"Saint-Bruno--Saint-Hubert" if district_code == 24061 & election == "2000 Canadian federal election"
replace district_name =	"Saint-Hyacinthe--Bagot" if district_code == 24062 & election == "2000 Canadian federal election"
replace district_name =	"Saint-Jean" if district_code == 24063 & election == "2000 Canadian federal election"
replace district_name =	"Saint-Lambert" if district_code == 24064 & election == "2000 Canadian federal election"
replace district_name =	"Saint-Laurent--Cartierville" if district_code == 24065 & election == "2000 Canadian federal election"
replace district_name =	"Saint-Leonard--Saint-Michel" if district_code == 24066 & election == "2000 Canadian federal election"
replace district_name =	"Saint-Maurice" if district_code == 24067 & election == "2000 Canadian federal election"
replace district_name =	"Shefford" if district_code == 24068 & election == "2000 Canadian federal election"
replace district_name =	"Sherbrooke" if district_code == 24069 & election == "2000 Canadian federal election"
replace district_name =	"Terrebonne--Blainville" if district_code == 24070 & election == "2000 Canadian federal election"
replace district_name =	"Trois-Rivieres" if district_code == 24071 & election == "2000 Canadian federal election"
replace district_name =	"Vaudreuil--Soulanges" if district_code == 24072 & election == "2000 Canadian federal election"
replace district_name =	"Vercheres" if district_code == 24073 & election == "2000 Canadian federal election"
replace district_name =	"Verdun--Saint-Henri" if district_code == 24074 & election == "2000 Canadian federal election"
replace district_name =	"Westmount--Ville-Marie" if district_code == 24075 & election == "2000 Canadian federal election"
replace district_name =	"Algoma--Manitoulin" if district_code == 35001 & election == "2000 Canadian federal election"
replace district_name =	"Barrie--Simcoe--Bradford" if district_code == 35002 & election == "2000 Canadian federal election"
replace district_name =	"Beaches--East York" if district_code == 35003 & election == "2000 Canadian federal election"
replace district_name =	"Bramalea--Gore--Malton" if district_code == 35004 & election == "2000 Canadian federal election"
replace district_name =	"Brampton Centre" if district_code == 35005 & election == "2000 Canadian federal election"
replace district_name =	"Brampton West--Mississauga" if district_code == 35006 & election == "2000 Canadian federal election"
replace district_name =	"Brant" if district_code == 35007 & election == "2000 Canadian federal election"
replace district_name =	"Broadview--Greenwood" if district_code == 35008 & election == "2000 Canadian federal election"
replace district_name =	"Bruce--Grey" if district_code == 35009 & election == "2000 Canadian federal election"
replace district_name =	"Burlington" if district_code == 35010 & election == "2000 Canadian federal election"
replace district_name =	"Cambridge" if district_code == 35011 & election == "2000 Canadian federal election"
replace district_name =	"Davenport" if district_code == 35012 & election == "2000 Canadian federal election"
replace district_name =	"Don Valley East" if district_code == 35013 & election == "2000 Canadian federal election"
replace district_name =	"Don Valley West" if district_code == 35014 & election == "2000 Canadian federal election"
replace district_name =	"Dufferin--Peel--Wellington--Grey" if district_code == 35015 & election == "2000 Canadian federal election"
replace district_name =	"Durham" if district_code == 35016 & election == "2000 Canadian federal election"
replace district_name =	"Eglinton--Lawrence" if district_code == 35017 & election == "2000 Canadian federal election"
replace district_name =	"Elgin--Middlesex--London" if district_code == 35018 & election == "2000 Canadian federal election"
replace district_name =	"Erie--Lincoln" if district_code == 35019 & election == "2000 Canadian federal election"
replace district_name =	"Essex" if district_code == 35020 & election == "2000 Canadian federal election"
replace district_name =	"Etobicoke Centre" if district_code == 35021 & election == "2000 Canadian federal election"
replace district_name =	"Etobicoke--Lakeshore" if district_code == 35022 & election == "2000 Canadian federal election"
replace district_name =	"Etobicoke North" if district_code == 35023 & election == "2000 Canadian federal election"
replace district_name =	"Glengarry--Prescott--Russell" if district_code == 35024 & election == "2000 Canadian federal election"
replace district_name =	"Carleton--Gloucester" if district_code == 35025 & election == "2000 Canadian federal election"
replace district_name =	"Guelph--Wellington" if district_code == 35026 & election == "2000 Canadian federal election"
replace district_name =	"Haldimand--Norfolk--Brant" if district_code == 35027 & election == "2000 Canadian federal election"
replace district_name =	"Halton" if district_code == 35028 & election == "2000 Canadian federal election"
replace district_name =	"Hamilton East" if district_code == 35029 & election == "2000 Canadian federal election"
replace district_name =	"Hamilton Mountain" if district_code == 35030 & election == "2000 Canadian federal election"
replace district_name =	"Hamilton West" if district_code == 35031 & election == "2000 Canadian federal election"
replace district_name =	"Hastings--Frontenac--Lennox and Addington" if district_code == 35032 & election == "2000 Canadian federal election"
replace district_name =	"Huron--Bruce" if district_code == 35033 & election == "2000 Canadian federal election"
replace district_name =	"Kenora--Rainy River" if district_code == 35034 & election == "2000 Canadian federal election"
replace district_name =	"Kent--Essex" if district_code == 35035 & election == "2000 Canadian federal election"
replace district_name =	"Kingston and the Islands" if district_code == 35036 & election == "2000 Canadian federal election"
replace district_name =	"Kitchener Centre" if district_code == 35037 & election == "2000 Canadian federal election"
replace district_name =	"Kitchener--Waterloo" if district_code == 35038 & election == "2000 Canadian federal election"
replace district_name =	"Lambton--Kent--Middlesex" if district_code == 35039 & election == "2000 Canadian federal election"
replace district_name =	"Lanark--Carleton" if district_code == 35040 & election == "2000 Canadian federal election"
replace district_name =	"Leeds--Grenville" if district_code == 35041 & election == "2000 Canadian federal election"
replace district_name =	"London North Centre" if district_code == 35042 & election == "2000 Canadian federal election"
replace district_name =	"London--Fanshawe" if district_code == 35043 & election == "2000 Canadian federal election"
replace district_name =	"London West" if district_code == 35044 & election == "2000 Canadian federal election"
replace district_name =	"Markham" if district_code == 35045 & election == "2000 Canadian federal election"
replace district_name =	"Mississauga Centre" if district_code == 35046 & election == "2000 Canadian federal election"
replace district_name =	"Mississauga East" if district_code == 35047 & election == "2000 Canadian federal election"
replace district_name =	"Mississauga South" if district_code == 35048 & election == "2000 Canadian federal election"
replace district_name =	"Mississauga West" if district_code == 35049 & election == "2000 Canadian federal election"
replace district_name =	"Nepean--Carleton" if district_code == 35050 & election == "2000 Canadian federal election"
replace district_name =	"Niagara Centre" if district_code == 35051 & election == "2000 Canadian federal election"
replace district_name =	"Niagara Falls" if district_code == 35052 & election == "2000 Canadian federal election"
replace district_name =	"Nickel Belt" if district_code == 35053 & election == "2000 Canadian federal election"
replace district_name =	"Nipissing" if district_code == 35054 & election == "2000 Canadian federal election"
replace district_name =	"Northumberland" if district_code == 35055 & election == "2000 Canadian federal election"
replace district_name =	"Oak Ridges" if district_code == 35056 & election == "2000 Canadian federal election"
replace district_name =	"Oakville" if district_code == 35057 & election == "2000 Canadian federal election"
replace district_name =	"Oshawa" if district_code == 35058 & election == "2000 Canadian federal election"
replace district_name =	"Ottawa Centre" if district_code == 35059 & election == "2000 Canadian federal election"
replace district_name =	"Ottawa South" if district_code == 35060 & election == "2000 Canadian federal election"
replace district_name =	"Ottawa--Vanier" if district_code == 35061 & election == "2000 Canadian federal election"
replace district_name =	"Ottawa West--Nepean" if district_code == 35062 & election == "2000 Canadian federal election"
replace district_name =	"Oxford" if district_code == 35063 & election == "2000 Canadian federal election"
replace district_name =	"Parkdale--High Park" if district_code == 35064 & election == "2000 Canadian federal election"
replace district_name =	"Parry Sound--Muskoka" if district_code == 35065 & election == "2000 Canadian federal election"
replace district_name =	"Perth--Middlesex" if district_code == 35066 & election == "2000 Canadian federal election"
replace district_name =	"Peterborough" if district_code == 35067 & election == "2000 Canadian federal election"
replace district_name =	"Pickering--Ajax--Uxbridge" if district_code == 35068 & election == "2000 Canadian federal election"
replace district_name =	"Prince Edward--Hastings" if district_code == 35069 & election == "2000 Canadian federal election"
replace district_name =	"Renfrew--Nipissing--Pembroke" if district_code == 35070 & election == "2000 Canadian federal election"
replace district_name =	"Sarnia--Lambton" if district_code == 35071 & election == "2000 Canadian federal election"
replace district_name =	"Sault Ste. Marie" if district_code == 35072 & election == "2000 Canadian federal election"
replace district_name =	"Scarborough--Agincourt" if district_code == 35073 & election == "2000 Canadian federal election"
replace district_name =	"Scarborough Centre" if district_code == 35074 & election == "2000 Canadian federal election"
replace district_name =	"Scarborough East" if district_code == 35075 & election == "2000 Canadian federal election"
replace district_name =	"Scarborough--Rouge River" if district_code == 35076 & election == "2000 Canadian federal election"
replace district_name =	"Scarborough Southwest" if district_code == 35077 & election == "2000 Canadian federal election"
replace district_name =	"Simcoe--Grey" if district_code == 35078 & election == "2000 Canadian federal election"
replace district_name =	"Simcoe North" if district_code == 35079 & election == "2000 Canadian federal election"
replace district_name =	"St. Catharines" if district_code == 35080 & election == "2000 Canadian federal election"
replace district_name =	"St. Paul's" if district_code == 35081 & election == "2000 Canadian federal election"
replace district_name =	"Stoney Creek" if district_code == 35082 & election == "2000 Canadian federal election"
replace district_name =	"Stormont--Dundas" if district_code == 35083 & election == "2000 Canadian federal election"
replace district_name =	"Sudbury" if district_code == 35084 & election == "2000 Canadian federal election"
replace district_name =	"Thornhill" if district_code == 35085 & election == "2000 Canadian federal election"
replace district_name =	"Thunder Bay--Atikokan" if district_code == 35086 & election == "2000 Canadian federal election"
replace district_name =	"Thunder Bay--Nipigon" if district_code == 35087 & election == "2000 Canadian federal election"
replace district_name =	"Timiskaming--Cochrane" if district_code == 35088 & election == "2000 Canadian federal election"
replace district_name =	"Timmins--James Bay" if district_code == 35089 & election == "2000 Canadian federal election"
replace district_name =	"Toronto Centre--Rosedale" if district_code == 35090 & election == "2000 Canadian federal election"
replace district_name =	"Trinity--Spadina" if district_code == 35091 & election == "2000 Canadian federal election"
replace district_name =	"Vaughan--King--Aurora" if district_code == 35092 & election == "2000 Canadian federal election"
replace district_name =	"Victoria--Haliburton" if district_code == 35093 & election == "2000 Canadian federal election"
replace district_name =	"Waterloo--Wellington" if district_code == 35094 & election == "2000 Canadian federal election"
replace district_name =	"Wentworth--Burlington" if district_code == 35095 & election == "2000 Canadian federal election"
replace district_name =	"Whitby--Ajax" if district_code == 35096 & election == "2000 Canadian federal election"
replace district_name =	"Willowdale" if district_code == 35097 & election == "2000 Canadian federal election"
replace district_name =	"Windsor--St. Clair" if district_code == 35098 & election == "2000 Canadian federal election"
replace district_name =	"Windsor West" if district_code == 35099 & election == "2000 Canadian federal election"
replace district_name =	"York Centre" if district_code == 35100 & election == "2000 Canadian federal election"
replace district_name =	"York North" if district_code == 35101 & election == "2000 Canadian federal election"
replace district_name =	"York South--Weston" if district_code == 35102 & election == "2000 Canadian federal election"
replace district_name =	"York West" if district_code == 35103 & election == "2000 Canadian federal election"
replace district_name =	"Brandon--Souris" if district_code == 46001 & election == "2000 Canadian federal election"
replace district_name =	"Charleswood--Assiniboine" if district_code == 46002 & election == "2000 Canadian federal election"
replace district_name =	"Churchill" if district_code == 46003 & election == "2000 Canadian federal election"
replace district_name =	"Dauphin--Swan River" if district_code == 46004 & election == "2000 Canadian federal election"
replace district_name =	"Portage--Lisgar" if district_code == 46005 & election == "2000 Canadian federal election"
replace district_name =	"Provencher" if district_code == 46006 & election == "2000 Canadian federal election"
replace district_name =	"Saint Boniface" if district_code == 46007 & election == "2000 Canadian federal election"
replace district_name =	"Selkirk--Interlake" if district_code == 46008 & election == "2000 Canadian federal election"
replace district_name =	"Winnipeg North Centre" if district_code == 46009 & election == "2000 Canadian federal election"
replace district_name =	"Winnipeg Centre" if district_code == 46010 & election == "2000 Canadian federal election"
replace district_name =	"Winnipeg South" if district_code == 46011 & election == "2000 Canadian federal election"
replace district_name =	"Winnipeg South Centre" if district_code == 46012 & election == "2000 Canadian federal election"
replace district_name =	"Winnipeg North--St. Paul" if district_code == 46013 & election == "2000 Canadian federal election"
replace district_name =	"Winnipeg--Transcona" if district_code == 46014 & election == "2000 Canadian federal election"
replace district_name =	"Battlefords--Lloydminster" if district_code == 47001 & election == "2000 Canadian federal election"
replace district_name =	"Blackstrap" if district_code == 47002 & election == "2000 Canadian federal election"
replace district_name =	"Churchill River" if district_code == 47003 & election == "2000 Canadian federal election"
replace district_name =	"Cypress Hills--Grasslands" if district_code == 47004 & election == "2000 Canadian federal election"
replace district_name =	"Palliser" if district_code == 47005 & election == "2000 Canadian federal election"
replace district_name =	"Prince Albert" if district_code == 47006 & election == "2000 Canadian federal election"
replace district_name =	"Qu'Appelle" if district_code == 47007 & election == "2000 Canadian federal election"
replace district_name =	"Regina--Lumsden--Lake Centre" if district_code == 47008 & election == "2000 Canadian federal election"
replace district_name =	"Saskatoon--Humboldt" if district_code == 47009 & election == "2000 Canadian federal election"
replace district_name =	"Saskatoon--Rosetown--Biggar" if district_code == 47010 & election == "2000 Canadian federal election"
replace district_name =	"Souris--Moose Mountain" if district_code == 47011 & election == "2000 Canadian federal election"
replace district_name =	"Wanuskewin" if district_code == 47012 & election == "2000 Canadian federal election"
replace district_name =	"Wascana" if district_code == 47013 & election == "2000 Canadian federal election"
replace district_name =	"Yorkton--Melville" if district_code == 47014 & election == "2000 Canadian federal election"
replace district_name =	"Athabasca" if district_code == 48001 & election == "2000 Canadian federal election"
replace district_name =	"Calgary Centre" if district_code == 48002 & election == "2000 Canadian federal election"
replace district_name =	"Calgary East" if district_code == 48003 & election == "2000 Canadian federal election"
replace district_name =	"Calgary Northeast" if district_code == 48004 & election == "2000 Canadian federal election"
replace district_name =	"Calgary--Nose Hill" if district_code == 48005 & election == "2000 Canadian federal election"
replace district_name =	"Calgary Southeast" if district_code == 48006 & election == "2000 Canadian federal election"
replace district_name =	"Calgary Southwest" if district_code == 48007 & election == "2000 Canadian federal election"
replace district_name =	"Calgary West" if district_code == 48008 & election == "2000 Canadian federal election"
replace district_name =	"Crowfoot" if district_code == 48009 & election == "2000 Canadian federal election"
replace district_name =	"Edmonton East" if district_code == 48010 & election == "2000 Canadian federal election"
replace district_name =	"Edmonton North" if district_code == 48011 & election == "2000 Canadian federal election"
replace district_name =	"Edmonton Southeast" if district_code == 48012 & election == "2000 Canadian federal election"
replace district_name =	"Edmonton Southwest" if district_code == 48013 & election == "2000 Canadian federal election"
replace district_name =	"Edmonton--Strathcona" if district_code == 48014 & election == "2000 Canadian federal election"
replace district_name =	"Edmonton West" if district_code == 48015 & election == "2000 Canadian federal election"
replace district_name =	"Elk Island" if district_code == 48016 & election == "2000 Canadian federal election"
replace district_name =	"Lakeland" if district_code == 48017 & election == "2000 Canadian federal election"
replace district_name =	"Lethbridge" if district_code == 48018 & election == "2000 Canadian federal election"
replace district_name =	"Macleod" if district_code == 48019 & election == "2000 Canadian federal election"
replace district_name =	"Medicine Hat" if district_code == 48020 & election == "2000 Canadian federal election"
replace district_name =	"Peace River" if district_code == 48021 & election == "2000 Canadian federal election"
replace district_name =	"Red Deer" if district_code == 48022 & election == "2000 Canadian federal election"
replace district_name =	"St. Albert" if district_code == 48023 & election == "2000 Canadian federal election"
replace district_name =	"Wetaskiwin" if district_code == 48024 & election == "2000 Canadian federal election"
replace district_name =	"Wild Rose" if district_code == 48025 & election == "2000 Canadian federal election"
replace district_name =	"Yellowhead" if district_code == 48026 & election == "2000 Canadian federal election"
replace district_name =	"Burnaby--Douglas" if district_code == 59001 & election == "2000 Canadian federal election"
replace district_name =	"Cariboo--Chilcotin" if district_code == 59002 & election == "2000 Canadian federal election"
replace district_name =	"Delta--South Richmond" if district_code == 59003 & election == "2000 Canadian federal election"
replace district_name =	"Dewdney--Alouette" if district_code == 59004 & election == "2000 Canadian federal election"
replace district_name =	"Esquimalt--Juan de Fuca" if district_code == 59005 & election == "2000 Canadian federal election"
replace district_name =	"Fraser Valley" if district_code == 59006 & election == "2000 Canadian federal election"
replace district_name =	"Kamloops" if district_code == 59007 & election == "2000 Canadian federal election"
replace district_name =	"Kelowna" if district_code == 59008	& election == "2000 Canadian federal election"
replace district_name =	"Kootenay--Columbia" if district_code == 59009 & election == "2000 Canadian federal election"
replace district_name =	"Langley--Abbotsford" if district_code == 59010 & election == "2000 Canadian federal election"
replace district_name =	"Nanaimo--Alberni" if district_code == 59011 & election == "2000 Canadian federal election"
replace district_name =	"Nanaimo--Cowichan" if district_code == 59012 & election == "2000 Canadian federal election"
replace district_name =	"New Westminster--Coquitlam--Burnaby" if district_code == 59013 & election == "2000 Canadian federal election"
replace district_name =	"Okanagan--Shuswap" if district_code == 59014 & election == "2000 Canadian federal election"
replace district_name =	"North Vancouver" if district_code == 59015 & election == "2000 Canadian federal election"
replace district_name =	"Okanagan--Coquihalla" if district_code == 59016 & election == "2000 Canadian federal election"
replace district_name =	"Port Moody--Coquitlam" if district_code == 59017 & election == "2000 Canadian federal election"
replace district_name =	"Prince George--Bulkley Valley" if district_code == 59018 & election == "2000 Canadian federal election"
replace district_name =	"Prince George--Peace River" if district_code == 59019 & election == "2000 Canadian federal election"
replace district_name =	"Richmond" if district_code == 59020 & election == "2000 Canadian federal election"
replace district_name =	"Saanich--Gulf Islands" if district_code == 59021 & election == "2000 Canadian federal election"
replace district_name =	"Skeena" if district_code == 59022 & election == "2000 Canadian federal election"
replace district_name =	"South Surrey--White Rock--Langley" if district_code == 59023 & election == "2000 Canadian federal election"
replace district_name =	"Surrey Central" if district_code == 59024 & election == "2000 Canadian federal election"
replace district_name =	"Surrey North" if district_code == 59025 & election == "2000 Canadian federal election"
replace district_name =	"Vancouver Centre" if district_code == 59026 & election == "2000 Canadian federal election"
replace district_name =	"Vancouver East" if district_code == 59027 & election == "2000 Canadian federal election"
replace district_name =	"Vancouver Island North" if district_code == 59028 & election == "2000 Canadian federal election"
replace district_name =	"Vancouver Kingsway" if district_code == 59029 & election == "2000 Canadian federal election"
replace district_name =	"Vancouver Quadra" if district_code == 59030 & election == "2000 Canadian federal election"
replace district_name =	"Vancouver South--Burnaby" if district_code == 59031 & election == "2000 Canadian federal election"
replace district_name =	"Victoria" if district_code == 59032 & election == "2000 Canadian federal election"
replace district_name =	"West Kootenay--Okanagan" if district_code == 59033 & election == "2000 Canadian federal election"
replace district_name =	"West Vancouver--Sunshine Coast" if district_code == 59034 & election == "2000 Canadian federal election"
replace district_name = "Avalon" if district_code == 10001 & election == "2004 Canadian federal election"
replace district_name = "Bonavista--Exploits" if district_code == 10002 & election == "2004 Canadian federal election"
replace district_name = "Humber--St. Barbe--Baie Verte" if district_code == 10003 & election == "2004 Canadian federal election"
replace district_name = "Labrador" if district_code == 10004 & election == "2004 Canadian federal election"
replace district_name = "Random--Burin--St. George's" if district_code == 10005 & election == "2004 Canadian federal election"
replace district_name = "St. John's North/St. John's-Nord" if district_code == 10006 & election == "2004 Canadian federal election"
replace district_name = "St. John's South/St. John's-Sud" if district_code == 10007 & election == "2004 Canadian federal election"
replace district_name = "Cardigan" if district_code == 11001 & election == "2004 Canadian federal election"
replace district_name = "Charlottetown" if district_code == 11002 & election == "2004 Canadian federal election"
replace district_name = "Egmont" if district_code == 11003 & election == "2004 Canadian federal election"
replace district_name = "Malpeque" if district_code == 11004 & election == "2004 Canadian federal election"
replace district_name = "Cape Breton--Canso" if district_code == 12001 & election == "2004 Canadian federal election"
replace district_name = "Central Nova/Nova-Centre" if district_code == 12002 & election == "2004 Canadian federal election"
replace district_name = "Dartmouth--Cole Harbour" if district_code == 12003 & election == "2004 Canadian federal election"
replace district_name = "Halifax" if district_code == 12004 & election == "2004 Canadian federal election"
replace district_name = "Halifax West/Halifax-Ouest" if district_code == 12005 & election == "2004 Canadian federal election"
replace district_name = "Kings--Hants" if district_code == 12006 & election == "2004 Canadian federal election"
replace district_name = "North Nova/Nova-Nord" if district_code == 12007 & election == "2004 Canadian federal election"
replace district_name = "Sackville--Eastern Shore" if district_code == 12008 & election == "2004 Canadian federal election"
replace district_name = "South Shore--St. Margaret's" if district_code == 12009 & election == "2004 Canadian federal election"
replace district_name = "Sydney--Victoria" if district_code == 12010 & election == "2004 Canadian federal election"
replace district_name = "West Nova/Nova-Ouest" if district_code == 12011 & election == "2004 Canadian federal election"
replace district_name = "Acadie--Bathurst" if district_code == 13001 & election == "2004 Canadian federal election"
replace district_name = "Beauséjour" if district_code == 13002 & election == "2004 Canadian federal election"
replace district_name = "Fredericton" if district_code == 13003 & election == "2004 Canadian federal election"
replace district_name = "Fundy" if district_code == 13004 & election == "2004 Canadian federal election"
replace district_name = "Madawaska--Restigouche" if district_code == 13005 & election == "2004 Canadian federal election"
replace district_name = "Miramichi" if district_code == 13006 & election == "2004 Canadian federal election"
replace district_name = "Moncton--Riverview--Dieppe" if district_code == 13007 & election == "2004 Canadian federal election"
replace district_name = "St. Croix--Belleisle" if district_code == 13008 & election == "2004 Canadian federal election"
replace district_name = "Saint John" if district_code == 13009 & election == "2004 Canadian federal election"
replace district_name = "Tobique--Mactaquac" if district_code == 13010 & election == "2004 Canadian federal election"
replace district_name = "Abitibi--Témiscamingue" if district_code == 24001 & election == "2004 Canadian federal election"
replace district_name = "Ahuntsic" if district_code == 24002 & election == "2004 Canadian federal election"
replace district_name = "Alfred-Pellan" if district_code == 24003 & election == "2004 Canadian federal election"
replace district_name = "Argenteuil--Mirabel" if district_code == 24004 & election == "2004 Canadian federal election"
replace district_name = "Beauce" if district_code == 24005 & election == "2004 Canadian federal election"
replace district_name = "Beauharnois--Salaberry" if district_code == 24006 & election == "2004 Canadian federal election"
replace district_name = "Beauport" if district_code == 24007 & election == "2004 Canadian federal election"
replace district_name = "Berthier--Maskinongé" if district_code == 24008 & election == "2004 Canadian federal election"
replace district_name = "Bourassa" if district_code == 24009 & election == "2004 Canadian federal election"
replace district_name = "Brome--Missisquoi" if district_code == 24010 & election == "2004 Canadian federal election"
replace district_name = "Brossard--La Prairie" if district_code == 24011 & election == "2004 Canadian federal election"
replace district_name = "Chambly--Borduas" if district_code == 24012 & election == "2004 Canadian federal election"
replace district_name = "Charlesbourg" if district_code == 24013 & election == "2004 Canadian federal election"
replace district_name = "Charlevoix--Montmorency" if district_code == 24014 & election == "2004 Canadian federal election"
replace district_name = "Châteauguay--Saint-Constant" if district_code == 24015 & election == "2004 Canadian federal election"
replace district_name = "Chicoutimi--Le Fjord" if district_code == 24016 & election == "2004 Canadian federal election"
replace district_name = "Compton--Stanstead" if district_code == 24017 & election == "2004 Canadian federal election"
replace district_name = "Drummond" if district_code == 24018 & election == "2004 Canadian federal election"
replace district_name = "Gaspésie--Îles-de-la-Madeleine" if district_code == 24019 & election == "2004 Canadian federal election"
replace district_name = "Gatineau" if district_code == 24020 & election == "2004 Canadian federal election"
replace district_name = "Hochelaga" if district_code == 24021 & election == "2004 Canadian federal election"
replace district_name = "Honoré-Mercier" if district_code == 24022 & election == "2004 Canadian federal election"
replace district_name = "Hull--Aylmer" if district_code == 24023 & election == "2004 Canadian federal election"
replace district_name = "Jeanne-Le Ber" if district_code == 24024 & election == "2004 Canadian federal election"
replace district_name = "Joliette" if district_code == 24025 & election == "2004 Canadian federal election"
replace district_name = "Jonquière--Alma" if district_code == 24026 & election == "2004 Canadian federal election"
replace district_name = "Lac-Saint-Louis" if district_code == 24027 & election == "2004 Canadian federal election"
replace district_name = "La Pointe-de-l'Île" if district_code == 24028 & election == "2004 Canadian federal election"
replace district_name = "LaSalle--Émard" if district_code == 24029 & election == "2004 Canadian federal election"
replace district_name = "Laurentides--Labelle" if district_code == 24030 & election == "2004 Canadian federal election"
replace district_name = "Laurier" if district_code == 24031 & election == "2004 Canadian federal election"
replace district_name = "Laval" if district_code == 24032 & election == "2004 Canadian federal election"
replace district_name = "Laval--Les Îles" if district_code == 24033 & election == "2004 Canadian federal election"
replace district_name = "Lévis--Bellechasse" if district_code == 24034 & election == "2004 Canadian federal election"
replace district_name = "Longueuil" if district_code == 24035 & election == "2004 Canadian federal election"
replace district_name = "Lotbinière--Chutes-de-la-Chaudière" if district_code == 24036 & election == "2004 Canadian federal election"
replace district_name = "Louis-Hébert" if district_code == 24037 & election == "2004 Canadian federal election"
replace district_name = "Louis-Saint-Laurent" if district_code == 24038 & election == "2004 Canadian federal election"
replace district_name = "Manicouagan" if district_code == 24039 & election == "2004 Canadian federal election"
replace district_name = "Marc-Aurèle-Fortin" if district_code == 24040 & election == "2004 Canadian federal election"
replace district_name = "Matapédia--Matane" if district_code == 24041 & election == "2004 Canadian federal election"
replace district_name = "Mégantic--L'Érable" if district_code == 24042 & election == "2004 Canadian federal election"
replace district_name = "Montcalm" if district_code == 24043 & election == "2004 Canadian federal election"
replace district_name = "Mount Royal/Mont-Royal" if district_code == 24044 & election == "2004 Canadian federal election"
replace district_name = "Notre-Dame-de-Grâce--Lachine" if district_code == 24045 & election == "2004 Canadian federal election"
replace district_name = "Nunavik--Eeyou" if district_code == 24046 & election == "2004 Canadian federal election"
replace district_name = "Outremont" if district_code == 24047 & election == "2004 Canadian federal election"
replace district_name = "Papineau" if district_code == 24048 & election == "2004 Canadian federal election"
replace district_name = "Pierrefonds--Dollard" if district_code == 24049 & election == "2004 Canadian federal election"
replace district_name = "Pontiac" if district_code == 24050 & election == "2004 Canadian federal election"
replace district_name = "Portneuf" if district_code == 24051 & election == "2004 Canadian federal election"
replace district_name = "Québec" if district_code == 24052 & election == "2004 Canadian federal election"
replace district_name = "Repentigny" if district_code == 24053 & election == "2004 Canadian federal election"
replace district_name = "Richelieu" if district_code == 24054 & election == "2004 Canadian federal election"
replace district_name = "Richmond--Arthabaska" if district_code == 24055 & election == "2004 Canadian federal election"
replace district_name = "Rimouski--Témiscouata" if district_code == 24056 & election == "2004 Canadian federal election"
replace district_name = "Rivière-des-Mille-Îles" if district_code == 24057 & election == "2004 Canadian federal election"
replace district_name = "Rivière-du-Loup--Montmagny" if district_code == 24058 & election == "2004 Canadian federal election"
replace district_name = "Rivière-du-Nord" if district_code == 24059 & election == "2004 Canadian federal election"
replace district_name = "Roberval" if district_code == 24060 & election == "2004 Canadian federal election"
replace district_name = "Rosemont--La Petite-Patrie" if district_code == 24061 & election == "2004 Canadian federal election"
replace district_name = "Saint-Bruno--Saint-Hubert" if district_code == 24062 & election == "2004 Canadian federal election"
replace district_name = "Saint-Hyacinthe--Bagot" if district_code == 24063 & election == "2004 Canadian federal election"
replace district_name = "Saint-Jean" if district_code == 24064 & election == "2004 Canadian federal election"
replace district_name = "Saint-Lambert" if district_code == 24065 & election == "2004 Canadian federal election"
replace district_name = "Saint-Laurent--Cartierville" if district_code == 24066 & election == "2004 Canadian federal election"
replace district_name = "Saint-Léonard--Saint-Michel" if district_code == 24067 & election == "2004 Canadian federal election"
replace district_name = "Saint-Maurice--Champlain" if district_code == 24068 & election == "2004 Canadian federal election"
replace district_name = "Shefford" if district_code == 24069 & election == "2004 Canadian federal election"
replace district_name = "Sherbrooke" if district_code == 24070 & election == "2004 Canadian federal election"
replace district_name = "Terrebonne--Blainville" if district_code == 24071 & election == "2004 Canadian federal election"
replace district_name = "Trois-Rivières" if district_code == 24072 & election == "2004 Canadian federal election"
replace district_name = "Vaudreuil-Soulanges" if district_code == 24073 & election == "2004 Canadian federal election"
replace district_name = "Verchères--Les Patriotes" if district_code == 24074 & election == "2004 Canadian federal election"
replace district_name = "Westmount--Ville-Marie" if district_code == 24075 & election == "2004 Canadian federal election"
replace district_name = "Ajax--Pickering" if district_code == 35001 & election == "2004 Canadian federal election"
replace district_name = "Algoma--Manitoulin--Kapuskasing" if district_code == 35002 & election == "2004 Canadian federal election"
replace district_name = "Ancaster--Dundas--Flamborough--Westdale" if district_code == 35003 & election == "2004 Canadian federal election"
replace district_name = "Barrie" if district_code == 35004 & election == "2004 Canadian federal election"
replace district_name = "Beaches--East York" if district_code == 35005 & election == "2004 Canadian federal election"
replace district_name = "Bramalea--Gore--Malton" if district_code == 35006 & election == "2004 Canadian federal election"
replace district_name = "Brampton--Springdale" if district_code == 35007 & election == "2004 Canadian federal election"
replace district_name = "Brampton West/Brampton-Ouest" if district_code == 35008 & election == "2004 Canadian federal election"
replace district_name = "Brant" if district_code == 35009 & election == "2004 Canadian federal election"
replace district_name = "Burlington" if district_code == 35010 & election == "2004 Canadian federal election"
replace district_name = "Cambridge" if district_code == 35011 & election == "2004 Canadian federal election"
replace district_name = "Carleton--Lanark" if district_code == 35012 & election == "2004 Canadian federal election"
replace district_name = "Chatham-Kent--Essex" if district_code == 35013 & election == "2004 Canadian federal election"
replace district_name = "Clarington--Scugog--Uxbridge" if district_code == 35014 & election == "2004 Canadian federal election"
replace district_name = "Davenport" if district_code == 35015 & election == "2004 Canadian federal election"
replace district_name = "Don Valley East/Don Valley-Est" if district_code == 35016 & election == "2004 Canadian federal election"
replace district_name = "Don Valley West/Don Valley-Ouest" if district_code == 35017 & election == "2004 Canadian federal election"
replace district_name = "Dufferin--Caledon" if district_code == 35018 & election == "2004 Canadian federal election"
replace district_name = "Eglinton--Lawrence" if district_code == 35019 & election == "2004 Canadian federal election"
replace district_name = "Elgin--Middlesex--London" if district_code == 35020 & election == "2004 Canadian federal election"
replace district_name = "Essex" if district_code == 35021 & election == "2004 Canadian federal election"
replace district_name = "Etobicoke Centre/Etobicoke-Centre" if district_code == 35022 & election == "2004 Canadian federal election"
replace district_name = "Etobicoke--Lakeshore" if district_code == 35023 & election == "2004 Canadian federal election"
replace district_name = "Etobicoke North/Etobicoke-Nord" if district_code == 35024 & election == "2004 Canadian federal election"
replace district_name = "Glengarry--Prescott--Russell" if district_code == 35025 & election == "2004 Canadian federal election"
replace district_name = "Grey--Bruce--Owen Sound" if district_code == 35026 & election == "2004 Canadian federal election"
replace district_name = "Guelph" if district_code == 35027 & election == "2004 Canadian federal election"
replace district_name = "Haldimand--Norfolk" if district_code == 35028 & election == "2004 Canadian federal election"
replace district_name = "Haliburton--Kawartha Lakes--Brock" if district_code == 35029 & election == "2004 Canadian federal election"
replace district_name = "Halton" if district_code == 35030 & election == "2004 Canadian federal election"
replace district_name = "Hamilton Centre/Hamilton-Centre" if district_code == 35031 & election == "2004 Canadian federal election"
replace district_name = "Hamilton East--Stoney Creek/Hamilton-Est--Stoney Creek" if district_code == 35032 & election == "2004 Canadian federal election"
replace district_name = "Hamilton Mountain" if district_code == 35033 & election == "2004 Canadian federal election"
replace district_name = "Huron--Bruce" if district_code == 35034 & election == "2004 Canadian federal election"
replace district_name = "Kenora" if district_code == 35035 & election == "2004 Canadian federal election"
replace district_name = "Kingston and the Islands/Kingston et les Îles" if district_code == 35036 & election == "2004 Canadian federal election"
replace district_name = "Kitchener Centre/Kitchener-Centre" if district_code == 35037 & election == "2004 Canadian federal election"
replace district_name = "Kitchener--Conestoga" if district_code == 35038 & election == "2004 Canadian federal election"
replace district_name = "Kitchener--Waterloo" if district_code == 35039 & election == "2004 Canadian federal election"
replace district_name = "Lanark--Frontenac--Lennox and Addington" if district_code == 35040 & election == "2004 Canadian federal election"
replace district_name = "Leeds--Grenville" if district_code == 35041 & election == "2004 Canadian federal election"
replace district_name = "London--Fanshawe" if district_code == 35042 & election == "2004 Canadian federal election"
replace district_name = "London North Centre/London-Centre-Nord" if district_code == 35043 & election == "2004 Canadian federal election"
replace district_name = "London West/London-Ouest" if district_code == 35044 & election == "2004 Canadian federal election"
replace district_name = "Markham--Unionville" if district_code == 35045 & election == "2004 Canadian federal election"
replace district_name = "Middlesex--Kent--Lambton" if district_code == 35046 & election == "2004 Canadian federal election"
replace district_name = "Mississauga--Brampton South/Mississauga--Brampton-Sud" if district_code == 35047 & election == "2004 Canadian federal election"
replace district_name = "Mississauga East--Cooksville/Mississauga-Est--Cooksville" if district_code == 35048 & election == "2004 Canadian federal election"
replace district_name = "Mississauga--Erindale" if district_code == 35049 & election == "2004 Canadian federal election"
replace district_name = "Mississauga South/Mississauga-Sud" if district_code == 35050 & election == "2004 Canadian federal election"
replace district_name = "Mississauga--Streetsville" if district_code == 35051 & election == "2004 Canadian federal election"
replace district_name = "Nepean--Carleton" if district_code == 35052 & election == "2004 Canadian federal election"
replace district_name = "Newmarket--Aurora" if district_code == 35053 & election == "2004 Canadian federal election"
replace district_name = "Niagara Falls" if district_code == 35054 & election == "2004 Canadian federal election"
replace district_name = "Niagara West--Glanbrook/Niagara-Ouest--Glanbrook" if district_code == 35055 & election == "2004 Canadian federal election"
replace district_name = "Nickel Belt" if district_code == 35056 & election == "2004 Canadian federal election"
replace district_name = "Nipissing--Timiskaming" if district_code == 35057 & election == "2004 Canadian federal election"
replace district_name = "Northumberland--Quinte West" if district_code == 35058 & election == "2004 Canadian federal election"
replace district_name = "Oak Ridges--Markham" if district_code == 35059 & election == "2004 Canadian federal election"
replace district_name = "Oakville" if district_code == 35060 & election == "2004 Canadian federal election"
replace district_name = "Oshawa" if district_code == 35061 & election == "2004 Canadian federal election"
replace district_name = "Ottawa Centre/Ottawa-Centre" if district_code == 35062 & election == "2004 Canadian federal election"
replace district_name = "Ottawa--Orléans" if district_code == 35063 & election == "2004 Canadian federal election"
replace district_name = "Ottawa South/Ottawa-Sud" if district_code == 35064 & election == "2004 Canadian federal election"
replace district_name = "Ottawa--Vanier" if district_code == 35065 & election == "2004 Canadian federal election"
replace district_name = "Ottawa West--Nepean/Ottawa-Ouest--Nepean" if district_code == 35066 & election == "2004 Canadian federal election"
replace district_name = "Oxford" if district_code == 35067 & election == "2004 Canadian federal election"
replace district_name = "Parkdale--High Park" if district_code == 35068 & election == "2004 Canadian federal election"
replace district_name = "Parry Sound--Muskoka" if district_code == 35069 & election == "2004 Canadian federal election"
replace district_name = "Perth--Wellington" if district_code == 35070 & election == "2004 Canadian federal election"
replace district_name = "Peterborough" if district_code == 35071 & election == "2004 Canadian federal election"
replace district_name = "Pickering--Scarborough East/Pickering--Scarborough-Est" if district_code == 35072 & election == "2004 Canadian federal election"
replace district_name = "Prince Edward--Hastings" if district_code == 35073 & election == "2004 Canadian federal election"
replace district_name = "Renfrew--Nipissing--Pembroke" if district_code == 35074 & election == "2004 Canadian federal election"
replace district_name = "Richmond Hill" if district_code == 35075 & election == "2004 Canadian federal election"
replace district_name = "St. Catharines" if district_code == 35076 & election == "2004 Canadian federal election"
replace district_name = "St. Paul's" if district_code == 35077 & election == "2004 Canadian federal election"
replace district_name = "Sarnia--Lambton" if district_code == 35078 & election == "2004 Canadian federal election"
replace district_name = "Sault Ste. Marie" if district_code == 35079 & election == "2004 Canadian federal election"
replace district_name = "Scarborough--Agincourt" if district_code == 35080 & election == "2004 Canadian federal election"
replace district_name = "Scarborough Centre/Scarborough-Centre" if district_code == 35081 & election == "2004 Canadian federal election"
replace district_name = "Scarborough--Guildwood" if district_code == 35082 & election == "2004 Canadian federal election"
replace district_name = "Scarborough--Rouge River" if district_code == 35083 & election == "2004 Canadian federal election"
replace district_name = "Scarborough Southwest/Scarborough-Sud-Ouest" if district_code == 35084 & election == "2004 Canadian federal election"
replace district_name = "Simcoe--Grey" if district_code == 35085 & election == "2004 Canadian federal election"
replace district_name = "Simcoe North/Simcoe-Nord" if district_code == 35086 & election == "2004 Canadian federal election"
replace district_name = "Stormont--Dundas--South Glengarry" if district_code == 35087 & election == "2004 Canadian federal election"
replace district_name = "Sudbury" if district_code == 35088 & election == "2004 Canadian federal election"
replace district_name = "Thornhill" if district_code == 35089 & election == "2004 Canadian federal election"
replace district_name = "Thunder Bay--Rainy River" if district_code == 35090 & election == "2004 Canadian federal election"
replace district_name = "Thunder Bay--Superior North/Thunder Bay--Superior-Nord" if district_code == 35091 & election == "2004 Canadian federal election"
replace district_name = "Timmins--James Bay/Timmins--Baie James" if district_code == 35092 & election == "2004 Canadian federal election"
replace district_name = "Toronto Centre/Toronto-Centre" if district_code == 35093 & election == "2004 Canadian federal election"
replace district_name = "Toronto--Danforth" if district_code == 35094 & election == "2004 Canadian federal election"
replace district_name = "Trinity--Spadina" if district_code == 35095 & election == "2004 Canadian federal election"
replace district_name = "Vaughan" if district_code == 35096 & election == "2004 Canadian federal election"
replace district_name = "Welland" if district_code == 35097 & election == "2004 Canadian federal election"
replace district_name = "Wellington--Halton Hills" if district_code == 35098 & election == "2004 Canadian federal election"
replace district_name = "Whitby--Oshawa" if district_code == 35099 & election == "2004 Canadian federal election"
replace district_name = "Willowdale" if district_code == 35100 & election == "2004 Canadian federal election"
replace district_name = "Windsor--Tecumseh" if district_code == 35101 & election == "2004 Canadian federal election"
replace district_name = "Windsor West/Windsor-Ouest" if district_code == 35102 & election == "2004 Canadian federal election"
replace district_name = "York Centre/York-Centre" if district_code == 35103 & election == "2004 Canadian federal election"
replace district_name = "York--Simcoe" if district_code == 35104 & election == "2004 Canadian federal election"
replace district_name = "York South--Weston/York-Sud--Weston" if district_code == 35105 & election == "2004 Canadian federal election"
replace district_name = "York West/York-Ouest" if district_code == 35106 & election == "2004 Canadian federal election"
replace district_name = "Brandon--Souris" if district_code == 46001 & election == "2004 Canadian federal election"
replace district_name = "Charleswood--St. James" if district_code == 46002 & election == "2004 Canadian federal election"
replace district_name = "Churchill" if district_code == 46003 & election == "2004 Canadian federal election"
replace district_name = "Dauphin--Swan River" if district_code == 46004 & election == "2004 Canadian federal election"
replace district_name = "Elmwood--Transcona" if district_code == 46005 & election == "2004 Canadian federal election"
replace district_name = "Kildonan--St. Paul" if district_code == 46006 & election == "2004 Canadian federal election"
replace district_name = "Portage--Lisgar" if district_code == 46007 & election == "2004 Canadian federal election"
replace district_name = "Provencher" if district_code == 46008 & election == "2004 Canadian federal election"
replace district_name = "Saint Boniface/Saint-Boniface" if district_code == 46009 & election == "2004 Canadian federal election"
replace district_name = "Selkirk--Interlake" if district_code == 46010 & election == "2004 Canadian federal election"
replace district_name = "Winnipeg Centre/Winnipeg-Centre" if district_code == 46011 & election == "2004 Canadian federal election"
replace district_name = "Winnipeg North/Winnipeg-Nord" if district_code == 46012 & election == "2004 Canadian federal election"
replace district_name = "Winnipeg South/Winnipeg-Sud" if district_code == 46013 & election == "2004 Canadian federal election"
replace district_name = "Winnipeg South Centre/Winnipeg-Centre-Sud" if district_code == 46014 & election == "2004 Canadian federal election"
replace district_name = "Battlefords--Lloydminster" if district_code == 47001 & election == "2004 Canadian federal election"
replace district_name = "Blackstrap" if district_code == 47002 & election == "2004 Canadian federal election"
replace district_name = "Churchill River/Rivière Churchill" if district_code == 47003 & election == "2004 Canadian federal election"
replace district_name = "Cypress Hills--Grasslands" if district_code == 47004 & election == "2004 Canadian federal election"
replace district_name = "Palliser" if district_code == 47005 & election == "2004 Canadian federal election"
replace district_name = "Prince Albert" if district_code == 47006 & election == "2004 Canadian federal election"
replace district_name = "Regina--Lumsden--Lake Centre" if district_code == 47007 & election == "2004 Canadian federal election"
replace district_name = "Regina--Qu'Appelle" if district_code == 47008 & election == "2004 Canadian federal election"
replace district_name = "Saskatoon--Humboldt" if district_code == 47009 & election == "2004 Canadian federal election"
replace district_name = "Saskatoon--Rosetown--Biggar" if district_code == 47010 & election == "2004 Canadian federal election"
replace district_name = "Saskatoon--Wanuskewin" if district_code == 47011 & election == "2004 Canadian federal election"
replace district_name = "Souris--Moose Mountain" if district_code == 47012 & election == "2004 Canadian federal election"
replace district_name = "Wascana" if district_code == 47013 & election == "2004 Canadian federal election"
replace district_name = "Yorkton--Melville" if district_code == 47014 & election == "2004 Canadian federal election"
replace district_name = "Athabasca" if district_code == 48001 & election == "2004 Canadian federal election"
replace district_name = "Calgary East/Calgary-Est" if district_code == 48002 & election == "2004 Canadian federal election"
replace district_name = "Calgary North Centre/Calgary-Centre-Nord" if district_code == 48003 & election == "2004 Canadian federal election"
replace district_name = "Calgary Northeast/Calgary-Nord-Est" if district_code == 48004 & election == "2004 Canadian federal election"
replace district_name = "Calgary--Nose Hill" if district_code == 48005 & election == "2004 Canadian federal election"
replace district_name = "Calgary South Centre/Calgary-Centre-Sud" if district_code == 48006 & election == "2004 Canadian federal election"
replace district_name = "Calgary Southeast/Calgary-Sud-Est" if district_code == 48007 & election == "2004 Canadian federal election"
replace district_name = "Calgary Southwest/Calgary-Sud-Ouest" if district_code == 48008 & election == "2004 Canadian federal election"
replace district_name = "Calgary West/Calgary-Ouest" if district_code == 48009 & election == "2004 Canadian federal election"
replace district_name = "Crowfoot" if district_code == 48010 & election == "2004 Canadian federal election"
replace district_name = "Edmonton--Beaumont" if district_code == 48011 & election == "2004 Canadian federal election"
replace district_name = "Edmonton Centre/Edmonton-Centre" if district_code == 48012 & election == "2004 Canadian federal election"
replace district_name = "Edmonton East/Edmonton-Est" if district_code == 48013 & election == "2004 Canadian federal election"
replace district_name = "Edmonton--Leduc" if district_code == 48014 & election == "2004 Canadian federal election"
replace district_name = "Edmonton--St. Albert" if district_code == 48015 & election == "2004 Canadian federal election"
replace district_name = "Edmonton--Sherwood Park" if district_code == 48016 & election == "2004 Canadian federal election"
replace district_name = "Edmonton--Spruce Grove" if district_code == 48017 & election == "2004 Canadian federal election"
replace district_name = "Edmonton--Strathcona" if district_code == 48018 & election == "2004 Canadian federal election"
replace district_name = "Lethbridge" if district_code == 48019 & election == "2004 Canadian federal election"
replace district_name = "Macleod" if district_code == 48020 & election == "2004 Canadian federal election"
replace district_name = "Medicine Hat" if district_code == 48021 & election == "2004 Canadian federal election"
replace district_name = "Peace River" if district_code == 48022 & election == "2004 Canadian federal election"
replace district_name = "Red Deer" if district_code == 48023 & election == "2004 Canadian federal election"
replace district_name = "Vegreville--Wainwright" if district_code == 48024 & election == "2004 Canadian federal election"
replace district_name = "Westlock--St. Paul" if district_code == 48025 & election == "2004 Canadian federal election"
replace district_name = "Wetaskiwin" if district_code == 48026 & election == "2004 Canadian federal election"
replace district_name = "Wild Rose" if district_code == 48027 & election == "2004 Canadian federal election"
replace district_name = "Yellowhead" if district_code == 48028 & election == "2004 Canadian federal election"
replace district_name = "Abbotsford" if district_code == 59001 & election == "2004 Canadian federal election"
replace district_name = "Burnaby--Douglas" if district_code == 59002 & election == "2004 Canadian federal election"
replace district_name = "Burnaby--New Westminster" if district_code == 59003 & election == "2004 Canadian federal election"
replace district_name = "Cariboo--Prince George" if district_code == 59004 & election == "2004 Canadian federal election"
replace district_name = "Chilliwack--Fraser Canyon" if district_code == 59005 & election == "2004 Canadian federal election"
replace district_name = "Delta--Richmond East/Delta--Richmond-Est" if district_code == 59006 & election == "2004 Canadian federal election"
replace district_name = "Dewdney--Alouette" if district_code == 59007 & election == "2004 Canadian federal election"
replace district_name = "Esquimalt--Juan de Fuca" if district_code == 59008 & election == "2004 Canadian federal election"
replace district_name = "Fleetwood--Port Kells" if district_code == 59009 & election == "2004 Canadian federal election"
replace district_name = "Kamloops--Thompson" if district_code == 59010 & election == "2004 Canadian federal election"
replace district_name = "Kelowna" if district_code == 59011 & election == "2004 Canadian federal election"
replace district_name = "Kootenay--Columbia" if district_code == 59012 & election == "2004 Canadian federal election"
replace district_name = "Langley" if district_code == 59013 & election == "2004 Canadian federal election"
replace district_name = "Nanaimo--Alberni" if district_code == 59014 & election == "2004 Canadian federal election"
replace district_name = "Nanaimo--Cowichan" if district_code == 59015 & election == "2004 Canadian federal election"
replace district_name = "Newton--North Delta/Newton--Delta-Nord" if district_code == 59016 & election == "2004 Canadian federal election"
replace district_name = "New Westminster--Coquitlam" if district_code == 59017 & election == "2004 Canadian federal election"
replace district_name = "North Okanagan--Shuswap/Okanagan-Nord--Shuswap" if district_code == 59018 & election == "2004 Canadian federal election"
replace district_name = "North Vancouver" if district_code == 59019 & election == "2004 Canadian federal election"
replace district_name = "Okanagan--Coquihalla" if district_code == 59020 & election == "2004 Canadian federal election"
replace district_name = "Port Moody--Westwood--Port Coquitlam" if district_code == 59021 & election == "2004 Canadian federal election"
replace district_name = "Prince George--Peace River" if district_code == 59022 & election == "2004 Canadian federal election"
replace district_name = "Richmond" if district_code == 59023 & election == "2004 Canadian federal election"
replace district_name = "Saanich--Gulf Islands" if district_code == 59024 & election == "2004 Canadian federal election"
replace district_name = "Skeena--Bulkley Valley" if district_code == 59025 & election == "2004 Canadian federal election"
replace district_name = "Southern Interior" if district_code == 59026 & election == "2004 Canadian federal election"
replace district_name = "South Surrey--White Rock--Cloverdale/Surrey-Sud--White Rock--Cloverdale" if district_code == 59027 & election == "2004 Canadian federal election"
replace district_name = "Surrey North/Surrey-Nord" if district_code == 59028 & election == "2004 Canadian federal election"
replace district_name = "Vancouver Centre/Vancouver-Centre" if district_code == 59029 & election == "2004 Canadian federal election"
replace district_name = "Vancouver East/Vancouver-Est" if district_code == 59030 & election == "2004 Canadian federal election"
replace district_name = "Vancouver Island North/Île de Vancouver-Nord" if district_code == 59031 & election == "2004 Canadian federal election"
replace district_name = "Vancouver Kingsway" if district_code == 59032 & election == "2004 Canadian federal election"
replace district_name = "Vancouver Quadra" if district_code == 59033 & election == "2004 Canadian federal election"
replace district_name = "Vancouver South/Vancouver-Sud" if district_code == 59034 & election == "2004 Canadian federal election"
replace district_name = "Victoria" if district_code == 59035 & election == "2004 Canadian federal election"
replace district_name = "West Vancouver--Sunshine Coast" if district_code == 59036 & election == "2004 Canadian federal election"
replace district_name = "Yukon" if district_code == 60001 & election == "2004 Canadian federal election"
replace district_name = "Western Arctic" if district_code == 61001 & election == "2004 Canadian federal election"
replace district_name = "Nunavut" if district_code == 62001 & election == "2004 Canadian federal election"
replace district_name = "Avalon" if district_code == 10001 & election == "2006 Canadian federal election"
replace district_name = "Bonavista--Gander--Grand Falls--Windsor" if district_code == 10002 & election == "2006 Canadian federal election"
replace district_name = "Humber--St. Barbe--Baie Verte" if district_code == 10003 & election == "2006 Canadian federal election"
replace district_name = "Labrador" if district_code == 10004 & election == "2006 Canadian federal election"
replace district_name = "Random--Burin--St. George's" if district_code == 10005 & election == "2006 Canadian federal election"
replace district_name = "St. John's East/St. John's-Est" if district_code == 10006 & election == "2006 Canadian federal election"
replace district_name = "St. John's South--Mount Pearl/St. John's-Sud--Mount Pearl" if district_code == 10007 & election == "2006 Canadian federal election"
replace district_name = "Cardigan" if district_code == 11001 & election == "2006 Canadian federal election"
replace district_name = "Charlottetown" if district_code == 11002 & election == "2006 Canadian federal election"
replace district_name = "Egmont" if district_code == 11003 & election == "2006 Canadian federal election"
replace district_name = "Malpeque" if district_code == 11004 & election == "2006 Canadian federal election"
replace district_name = "Cape Breton--Canso" if district_code == 12001 & election == "2006 Canadian federal election"
replace district_name = "Central Nova/Nova-Centre" if district_code == 12002 & election == "2006 Canadian federal election"
replace district_name = "Dartmouth--Cole Harbour" if district_code == 12003 & election == "2006 Canadian federal election"
replace district_name = "Halifax" if district_code == 12004 & election == "2006 Canadian federal election"
replace district_name = "Halifax West/Halifax-Ouest" if district_code == 12005 & election == "2006 Canadian federal election"
replace district_name = "Kings--Hants" if district_code == 12006 & election == "2006 Canadian federal election"
replace district_name = "Cumberland--Colchester--Musquodoboit Valley" if district_code == 12007 & election == "2006 Canadian federal election"
replace district_name = "Sackville--Eastern Shore" if district_code == 12008 & election == "2006 Canadian federal election"
replace district_name = "South Shore--St. Margaret's" if district_code == 12009 & election == "2006 Canadian federal election"
replace district_name = "Sydney--Victoria" if district_code == 12010 & election == "2006 Canadian federal election"
replace district_name = "West Nova/Nova-Ouest" if district_code == 12011 & election == "2006 Canadian federal election"
replace district_name = "Acadie--Bathurst" if district_code == 13001 & election == "2006 Canadian federal election"
replace district_name = "Beauséjour" if district_code == 13002 & election == "2006 Canadian federal election"
replace district_name = "Fredericton" if district_code == 13003 & election == "2006 Canadian federal election"
replace district_name = "Fundy Royal" if district_code == 13004 & election == "2006 Canadian federal election"
replace district_name = "Madawaska--Restigouche" if district_code == 13005 & election == "2006 Canadian federal election"
replace district_name = "Miramichi" if district_code == 13006 & election == "2006 Canadian federal election"
replace district_name = "Moncton--Riverview--Dieppe" if district_code == 13007 & election == "2006 Canadian federal election"
replace district_name = "New Brunswick Southwest/Nouveau-Brunswick-Sud-Ouest" if district_code == 13008 & election == "2006 Canadian federal election"
replace district_name = "Saint John" if district_code == 13009 & election == "2006 Canadian federal election"
replace district_name = "Tobique--Mactaquac" if district_code == 13010 & election == "2006 Canadian federal election"
replace district_name = "Abitibi--Témiscamingue" if district_code == 24001 & election == "2006 Canadian federal election"
replace district_name = "Ahuntsic" if district_code == 24002 & election == "2006 Canadian federal election"
replace district_name = "Alfred-Pellan" if district_code == 24003 & election == "2006 Canadian federal election"
replace district_name = "Argenteuil--Papineau--Mirabel" if district_code == 24004 & election == "2006 Canadian federal election"
replace district_name = "Beauce" if district_code == 24005 & election == "2006 Canadian federal election"
replace district_name = "Beauharnois--Salaberry" if district_code == 24006 & election == "2006 Canadian federal election"
replace district_name = "Beauport--Limoilou" if district_code == 24007 & election == "2006 Canadian federal election"
replace district_name = "Berthier--Maskinongé" if district_code == 24008 & election == "2006 Canadian federal election"
replace district_name = "Bourassa" if district_code == 24009 & election == "2006 Canadian federal election"
replace district_name = "Brome--Missisquoi" if district_code == 24010 & election == "2006 Canadian federal election"
replace district_name = "Brossard--La Prairie" if district_code == 24011 & election == "2006 Canadian federal election"
replace district_name = "Chambly--Borduas" if district_code == 24012 & election == "2006 Canadian federal election"
replace district_name = "Charlesbourg--Haute-Saint-Charles" if district_code == 24013 & election == "2006 Canadian federal election"
replace district_name = "Montmorency--Charlevoix--Haute-Côte-Nord" if district_code == 24014 & election == "2006 Canadian federal election"
replace district_name = "Châteauguay--Saint-Constant" if district_code == 24015 & election == "2006 Canadian federal election"
replace district_name = "Chicoutimi--Le Fjord" if district_code == 24016 & election == "2006 Canadian federal election"
replace district_name = "Compton--Stanstead" if district_code == 24017 & election == "2006 Canadian federal election"
replace district_name = "Drummond" if district_code == 24018 & election == "2006 Canadian federal election"
replace district_name = "Gaspésie--Îles-de-la-Madeleine" if district_code == 24019 & election == "2006 Canadian federal election"
replace district_name = "Gatineau" if district_code == 24020 & election == "2006 Canadian federal election"
replace district_name = "Hochelaga" if district_code == 24021 & election == "2006 Canadian federal election"
replace district_name = "Honoré-Mercier" if district_code == 24022 & election == "2006 Canadian federal election"
replace district_name = "Hull--Aylmer" if district_code == 24023 & election == "2006 Canadian federal election"
replace district_name = "Jeanne-Le Ber" if district_code == 24024 & election == "2006 Canadian federal election"
replace district_name = "Joliette" if district_code == 24025 & election == "2006 Canadian federal election"
replace district_name = "Jonquière--Alma" if district_code == 24026 & election == "2006 Canadian federal election"
replace district_name = "Lac-Saint-Louis" if district_code == 24027 & election == "2006 Canadian federal election"
replace district_name = "La Pointe-de-l'Île" if district_code == 24028 & election == "2006 Canadian federal election"
replace district_name = "LaSalle--Émard" if district_code == 24029 & election == "2006 Canadian federal election"
replace district_name = "Laurentides--Labelle" if district_code == 24030 & election == "2006 Canadian federal election"
replace district_name = "Laurier--Sainte-Marie" if district_code == 24031 & election == "2006 Canadian federal election"
replace district_name = "Laval" if district_code == 24032 & election == "2006 Canadian federal election"
replace district_name = "Laval--Les Îles" if district_code == 24033 & election == "2006 Canadian federal election"
replace district_name = "Lévis--Bellechasse" if district_code == 24034 & election == "2006 Canadian federal election"
replace district_name = "Longueuil--Pierre-Boucher" if district_code == 24035 & election == "2006 Canadian federal election"
replace district_name = "Lotbinière--Chutes-de-la-Chaudière" if district_code == 24036 & election == "2006 Canadian federal election"
replace district_name = "Louis-Hébert" if district_code == 24037 & election == "2006 Canadian federal election"
replace district_name = "Louis-Saint-Laurent" if district_code == 24038 & election == "2006 Canadian federal election"
replace district_name = "Manicouagan" if district_code == 24039 & election == "2006 Canadian federal election"
replace district_name = "Marc-Aurèle-Fortin" if district_code == 24040 & election == "2006 Canadian federal election"
replace district_name = "Haute-Gaspésie--La Mitis--Matane--Matapédia" if district_code == 24041 & election == "2006 Canadian federal election"
replace district_name = "Mégantic--L'Érable" if district_code == 24042 & election == "2006 Canadian federal election"
replace district_name = "Montcalm" if district_code == 24043 & election == "2006 Canadian federal election"
replace district_name = "Mount Royal/Mont-Royal" if district_code == 24044 & election == "2006 Canadian federal election"
replace district_name = "Notre-Dame-de-Grâce--Lachine" if district_code == 24045 & election == "2006 Canadian federal election"
replace district_name = "Abitibi--Baie-James--Nunavik--Eeyou" if district_code == 24046 & election == "2006 Canadian federal election"
replace district_name = "Outremont" if district_code == 24047 & election == "2006 Canadian federal election"
replace district_name = "Papineau" if district_code == 24048 & election == "2006 Canadian federal election"
replace district_name = "Pierrefonds--Dollard" if district_code == 24049 & election == "2006 Canadian federal election"
replace district_name = "Pontiac" if district_code == 24050 & election == "2006 Canadian federal election"
replace district_name = "Portneuf--Jacques-Cartier" if district_code == 24051 & election == "2006 Canadian federal election"
replace district_name = "Québec" if district_code == 24052 & election == "2006 Canadian federal election"
replace district_name = "Repentigny" if district_code == 24053 & election == "2006 Canadian federal election"
replace district_name = "Bas-Richelieu--Nicolet--Bécancour" if district_code == 24054 & election == "2006 Canadian federal election"
replace district_name = "Richmond--Arthabaska" if district_code == 24055 & election == "2006 Canadian federal election"
replace district_name = "Rimouski-Neigette--Témiscouata--Les Basques" if district_code == 24056 & election == "2006 Canadian federal election"
replace district_name = "Rivière-des-Mille-Îles" if district_code == 24057 & election == "2006 Canadian federal election"
replace district_name = "Montmagny--L'Islet--Kamouraska--Rivière-du-Loup" if district_code == 24058 & election == "2006 Canadian federal election"
replace district_name = "Rivière-du-Nord" if district_code == 24059 & election == "2006 Canadian federal election"
replace district_name = "Roberval--Lac-Saint-Jean" if district_code == 24060 & election == "2006 Canadian federal election"
replace district_name = "Rosemont--La Petite-Patrie" if district_code == 24061 & election == "2006 Canadian federal election"
replace district_name = "Saint-Bruno--Saint-Hubert" if district_code == 24062 & election == "2006 Canadian federal election"
replace district_name = "Saint-Hyacinthe--Bagot" if district_code == 24063 & election == "2006 Canadian federal election"
replace district_name = "Saint-Jean" if district_code == 24064 & election == "2006 Canadian federal election"
replace district_name = "Saint-Lambert" if district_code == 24065 & election == "2006 Canadian federal election"
replace district_name = "Saint-Laurent--Cartierville" if district_code == 24066 & election == "2006 Canadian federal election"
replace district_name = "Saint-Léonard--Saint-Michel" if district_code == 24067 & election == "2006 Canadian federal election"
replace district_name = "Saint-Maurice--Champlain" if district_code == 24068 & election == "2006 Canadian federal election"
replace district_name = "Shefford" if district_code == 24069 & election == "2006 Canadian federal election"
replace district_name = "Sherbrooke" if district_code == 24070 & election == "2006 Canadian federal election"
replace district_name = "Terrebonne--Blainville" if district_code == 24071 & election == "2006 Canadian federal election"
replace district_name = "Trois-Rivières" if district_code == 24072 & election == "2006 Canadian federal election"
replace district_name = "Vaudreuil-Soulanges" if district_code == 24073 & election == "2006 Canadian federal election"
replace district_name = "Verchères--Les Patriotes" if district_code == 24074 & election == "2006 Canadian federal election"
replace district_name = "Westmount--Ville-Marie" if district_code == 24075 & election == "2006 Canadian federal election"
replace district_name = "Ajax--Pickering" if district_code == 35001 & election == "2006 Canadian federal election"
replace district_name = "Algoma--Manitoulin--Kapuskasing" if district_code == 35002 & election == "2006 Canadian federal election"
replace district_name = "Ancaster--Dundas--Flamborough--Westdale" if district_code == 35003 & election == "2006 Canadian federal election"
replace district_name = "Barrie" if district_code == 35004 & election == "2006 Canadian federal election"
replace district_name = "Beaches--East York" if district_code == 35005 & election == "2006 Canadian federal election"
replace district_name = "Bramalea--Gore--Malton" if district_code == 35006 & election == "2006 Canadian federal election"
replace district_name = "Brampton--Springdale" if district_code == 35007 & election == "2006 Canadian federal election"
replace district_name = "Brampton West/Brampton-Ouest" if district_code == 35008 & election == "2006 Canadian federal election"
replace district_name = "Brant" if district_code == 35009 & election == "2006 Canadian federal election"
replace district_name = "Burlington" if district_code == 35010 & election == "2006 Canadian federal election"
replace district_name = "Cambridge" if district_code == 35011 & election == "2006 Canadian federal election"
replace district_name = "Carleton--Mississippi Mills" if district_code == 35012 & election == "2006 Canadian federal election"
replace district_name = "Chatham-Kent--Essex" if district_code == 35013 & election == "2006 Canadian federal election"
replace district_name = "Durham" if district_code == 35014 & election == "2006 Canadian federal election"
replace district_name = "Davenport" if district_code == 35015 & election == "2006 Canadian federal election"
replace district_name = "Don Valley East/Don Valley-Est" if district_code == 35016 & election == "2006 Canadian federal election"
replace district_name = "Don Valley West/Don Valley-Ouest" if district_code == 35017 & election == "2006 Canadian federal election"
replace district_name = "Dufferin--Caledon" if district_code == 35018 & election == "2006 Canadian federal election"
replace district_name = "Eglinton--Lawrence" if district_code == 35019 & election == "2006 Canadian federal election"
replace district_name = "Elgin--Middlesex--London" if district_code == 35020 & election == "2006 Canadian federal election"
replace district_name = "Essex" if district_code == 35021 & election == "2006 Canadian federal election"
replace district_name = "Etobicoke Centre/Etobicoke-Centre" if district_code == 35022 & election == "2006 Canadian federal election"
replace district_name = "Etobicoke--Lakeshore" if district_code == 35023 & election == "2006 Canadian federal election"
replace district_name = "Etobicoke North/Etobicoke-Nord" if district_code == 35024 & election == "2006 Canadian federal election"
replace district_name = "Glengarry--Prescott--Russell" if district_code == 35025 & election == "2006 Canadian federal election"
replace district_name = "Bruce--Grey--Owen Sound" if district_code == 35026 & election == "2006 Canadian federal election"
replace district_name = "Guelph" if district_code == 35027 & election == "2006 Canadian federal election"
replace district_name = "Haldimand--Norfolk" if district_code == 35028 & election == "2006 Canadian federal election"
replace district_name = "Haliburton--Kawartha Lakes--Brock" if district_code == 35029 & election == "2006 Canadian federal election"
replace district_name = "Halton" if district_code == 35030 & election == "2006 Canadian federal election"
replace district_name = "Hamilton Centre/Hamilton-Centre" if district_code == 35031 & election == "2006 Canadian federal election"
replace district_name = "Hamilton East--Stoney Creek/Hamilton-Est--Stoney Creek" if district_code == 35032 & election == "2006 Canadian federal election"
replace district_name = "Hamilton Mountain" if district_code == 35033 & election == "2006 Canadian federal election"
replace district_name = "Huron--Bruce" if district_code == 35034 & election == "2006 Canadian federal election"
replace district_name = "Kenora" if district_code == 35035 & election == "2006 Canadian federal election"
replace district_name = "Kingston and the Islands/Kingston et les Îles" if district_code == 35036 & election == "2006 Canadian federal election"
replace district_name = "Kitchener Centre/Kitchener-Centre" if district_code == 35037 & election == "2006 Canadian federal election"
replace district_name = "Kitchener--Conestoga" if district_code == 35038 & election == "2006 Canadian federal election"
replace district_name = "Kitchener--Waterloo" if district_code == 35039 & election == "2006 Canadian federal election"
replace district_name = "Lanark--Frontenac--Lennox and Addington" if district_code == 35040 & election == "2006 Canadian federal election"
replace district_name = "Leeds--Grenville" if district_code == 35041 & election == "2006 Canadian federal election"
replace district_name = "London--Fanshawe" if district_code == 35042 & election == "2006 Canadian federal election"
replace district_name = "London North Centre/London-Centre-Nord" if district_code == 35043 & election == "2006 Canadian federal election"
replace district_name = "London West/London-Ouest" if district_code == 35044 & election == "2006 Canadian federal election"
replace district_name = "Markham--Unionville" if district_code == 35045 & election == "2006 Canadian federal election"
replace district_name = "Lambton--Kent--Middlesex" if district_code == 35046 & election == "2006 Canadian federal election"
replace district_name = "Mississauga--Brampton South/Mississauga--Brampton-Sud" if district_code == 35047 & election == "2006 Canadian federal election"
replace district_name = "Mississauga East--Cooksville/Mississauga-Est--Cooksville" if district_code == 35048 & election == "2006 Canadian federal election"
replace district_name = "Mississauga--Erindale" if district_code == 35049 & election == "2006 Canadian federal election"
replace district_name = "Mississauga South/Mississauga-Sud" if district_code == 35050 & election == "2006 Canadian federal election"
replace district_name = "Mississauga--Streetsville" if district_code == 35051 & election == "2006 Canadian federal election"
replace district_name = "Nepean--Carleton" if district_code == 35052 & election == "2006 Canadian federal election"
replace district_name = "Newmarket--Aurora" if district_code == 35053 & election == "2006 Canadian federal election"
replace district_name = "Niagara Falls" if district_code == 35054 & election == "2006 Canadian federal election"
replace district_name = "Niagara West--Glanbrook/Niagara-Ouest--Glanbrook" if district_code == 35055 & election == "2006 Canadian federal election"
replace district_name = "Nickel Belt" if district_code == 35056 & election == "2006 Canadian federal election"
replace district_name = "Nipissing--Timiskaming" if district_code == 35057 & election == "2006 Canadian federal election"
replace district_name = "Northumberland--Quinte West" if district_code == 35058 & election == "2006 Canadian federal election"
replace district_name = "Oak Ridges--Markham" if district_code == 35059 & election == "2006 Canadian federal election"
replace district_name = "Oakville" if district_code == 35060 & election == "2006 Canadian federal election"
replace district_name = "Oshawa" if district_code == 35061 & election == "2006 Canadian federal election"
replace district_name = "Ottawa Centre/Ottawa-Centre" if district_code == 35062 & election == "2006 Canadian federal election"
replace district_name = "Ottawa--Orléans" if district_code == 35063 & election == "2006 Canadian federal election"
replace district_name = "Ottawa South/Ottawa-Sud" if district_code == 35064 & election == "2006 Canadian federal election"
replace district_name = "Ottawa--Vanier" if district_code == 35065 & election == "2006 Canadian federal election"
replace district_name = "Ottawa West--Nepean/Ottawa-Ouest--Nepean" if district_code == 35066 & election == "2006 Canadian federal election"
replace district_name = "Oxford" if district_code == 35067 & election == "2006 Canadian federal election"
replace district_name = "Parkdale--High Park" if district_code == 35068 & election == "2006 Canadian federal election"
replace district_name = "Parry Sound--Muskoka" if district_code == 35069 & election == "2006 Canadian federal election"
replace district_name = "Perth--Wellington" if district_code == 35070 & election == "2006 Canadian federal election"
replace district_name = "Peterborough" if district_code == 35071 & election == "2006 Canadian federal election"
replace district_name = "Pickering--Scarborough East/Pickering--Scarborough-Est" if district_code == 35072 & election == "2006 Canadian federal election"
replace district_name = "Prince Edward--Hastings" if district_code == 35073 & election == "2006 Canadian federal election"
replace district_name = "Renfrew--Nipissing--Pembroke" if district_code == 35074 & election == "2006 Canadian federal election"
replace district_name = "Richmond Hill" if district_code == 35075 & election == "2006 Canadian federal election"
replace district_name = "St. Catharines" if district_code == 35076 & election == "2006 Canadian federal election"
replace district_name = "St. Paul's" if district_code == 35077 & election == "2006 Canadian federal election"
replace district_name = "Sarnia--Lambton" if district_code == 35078 & election == "2006 Canadian federal election"
replace district_name = "Sault Ste. Marie" if district_code == 35079 & election == "2006 Canadian federal election"
replace district_name = "Scarborough--Agincourt" if district_code == 35080 & election == "2006 Canadian federal election"
replace district_name = "Scarborough Centre/Scarborough-Centre" if district_code == 35081 & election == "2006 Canadian federal election"
replace district_name = "Scarborough--Guildwood" if district_code == 35082 & election == "2006 Canadian federal election"
replace district_name = "Scarborough--Rouge River" if district_code == 35083 & election == "2006 Canadian federal election"
replace district_name = "Scarborough Southwest/Scarborough-Sud-Ouest" if district_code == 35084 & election == "2006 Canadian federal election"
replace district_name = "Simcoe--Grey" if district_code == 35085 & election == "2006 Canadian federal election"
replace district_name = "Simcoe North/Simcoe-Nord" if district_code == 35086 & election == "2006 Canadian federal election"
replace district_name = "Stormont--Dundas--South Glengarry" if district_code == 35087 & election == "2006 Canadian federal election"
replace district_name = "Sudbury" if district_code == 35088 & election == "2006 Canadian federal election"
replace district_name = "Thornhill" if district_code == 35089 & election == "2006 Canadian federal election"
replace district_name = "Thunder Bay--Rainy River" if district_code == 35090 & election == "2006 Canadian federal election"
replace district_name = "Thunder Bay--Superior North/Thunder Bay--Superior-Nord" if district_code == 35091 & election == "2006 Canadian federal election"
replace district_name = "Timmins--James Bay/Timmins--Baie James" if district_code == 35092 & election == "2006 Canadian federal election"
replace district_name = "Toronto Centre/Toronto-Centre" if district_code == 35093 & election == "2006 Canadian federal election"
replace district_name = "Toronto--Danforth" if district_code == 35094 & election == "2006 Canadian federal election"
replace district_name = "Trinity--Spadina" if district_code == 35095 & election == "2006 Canadian federal election"
replace district_name = "Vaughan" if district_code == 35096 & election == "2006 Canadian federal election"
replace district_name = "Welland" if district_code == 35097 & election == "2006 Canadian federal election"
replace district_name = "Wellington--Halton Hills" if district_code == 35098 & election == "2006 Canadian federal election"
replace district_name = "Whitby--Oshawa" if district_code == 35099 & election == "2006 Canadian federal election"
replace district_name = "Willowdale" if district_code == 35100 & election == "2006 Canadian federal election"
replace district_name = "Windsor--Tecumseh" if district_code == 35101 & election == "2006 Canadian federal election"
replace district_name = "Windsor West/Windsor-Ouest" if district_code == 35102 & election == "2006 Canadian federal election"
replace district_name = "York Centre/York-Centre" if district_code == 35103 & election == "2006 Canadian federal election"
replace district_name = "York--Simcoe" if district_code == 35104 & election == "2006 Canadian federal election"
replace district_name = "York South--Weston/York-Sud--Weston" if district_code == 35105 & election == "2006 Canadian federal election"
replace district_name = "York West/York-Ouest" if district_code == 35106 & election == "2006 Canadian federal election"
replace district_name = "Brandon--Souris" if district_code == 46001 & election == "2006 Canadian federal election"
replace district_name = "Charleswood--St. James--Assiniboia" if district_code == 46002 & election == "2006 Canadian federal election"
replace district_name = "Churchill" if district_code == 46003 & election == "2006 Canadian federal election"
replace district_name = "Dauphin--Swan River--Marquette" if district_code == 46004 & election == "2006 Canadian federal election"
replace district_name = "Elmwood--Transcona" if district_code == 46005 & election == "2006 Canadian federal election"
replace district_name = "Kildonan--St. Paul" if district_code == 46006 & election == "2006 Canadian federal election"
replace district_name = "Portage--Lisgar" if district_code == 46007 & election == "2006 Canadian federal election"
replace district_name = "Provencher" if district_code == 46008 & election == "2006 Canadian federal election"
replace district_name = "Saint Boniface/Saint-Boniface" if district_code == 46009 & election == "2006 Canadian federal election"
replace district_name = "Selkirk--Interlake" if district_code == 46010 & election == "2006 Canadian federal election"
replace district_name = "Winnipeg Centre/Winnipeg-Centre" if district_code == 46011 & election == "2006 Canadian federal election"
replace district_name = "Winnipeg North/Winnipeg-Nord" if district_code == 46012 & election == "2006 Canadian federal election"
replace district_name = "Winnipeg South/Winnipeg-Sud" if district_code == 46013 & election == "2006 Canadian federal election"
replace district_name = "Winnipeg South Centre/Winnipeg-Centre-Sud" if district_code == 46014 & election == "2006 Canadian federal election"
replace district_name = "Battlefords--Lloydminster" if district_code == 47001 & election == "2006 Canadian federal election"
replace district_name = "Blackstrap" if district_code == 47002 & election == "2006 Canadian federal election"
replace district_name = "Desnethé--Missinippi--Churchill River/Desnethé--Missinippi--Rivière Churchill" if district_code == 47003 & election == "2006 Canadian federal election"
replace district_name = "Cypress Hills--Grasslands" if district_code == 47004 & election == "2006 Canadian federal election"
replace district_name = "Palliser" if district_code == 47005 & election == "2006 Canadian federal election"
replace district_name = "Prince Albert" if district_code == 47006 & election == "2006 Canadian federal election"
replace district_name = "Regina--Lumsden--Lake Centre" if district_code == 47007 & election == "2006 Canadian federal election"
replace district_name = "Regina--Qu'Appelle" if district_code == 47008 & election == "2006 Canadian federal election"
replace district_name = "Saskatoon--Humboldt" if district_code == 47009 & election == "2006 Canadian federal election"
replace district_name = "Saskatoon--Rosetown--Biggar" if district_code == 47010 & election == "2006 Canadian federal election"
replace district_name = "Saskatoon--Wanuskewin" if district_code == 47011 & election == "2006 Canadian federal election"
replace district_name = "Souris--Moose Mountain" if district_code == 47012 & election == "2006 Canadian federal election"
replace district_name = "Wascana" if district_code == 47013 & election == "2006 Canadian federal election"
replace district_name = "Yorkton--Melville" if district_code == 47014 & election == "2006 Canadian federal election"
replace district_name = "Fort McMurray--Athabasca" if district_code == 48001 & election == "2006 Canadian federal election"
replace district_name = "Calgary East/Calgary-Est" if district_code == 48002 & election == "2006 Canadian federal election"
replace district_name = "Calgary Centre-North/Calgary-Centre-Nord" if district_code == 48003 & election == "2006 Canadian federal election"
replace district_name = "Calgary Northeast/Calgary-Nord-Est" if district_code == 48004 & election == "2006 Canadian federal election"
replace district_name = "Calgary--Nose Hill" if district_code == 48005 & election == "2006 Canadian federal election"
replace district_name = "Calgary Centre/Calgary-Centre" if district_code == 48006 & election == "2006 Canadian federal election"
replace district_name = "Calgary Southeast/Calgary-Sud-Est" if district_code == 48007 & election == "2006 Canadian federal election"
replace district_name = "Calgary Southwest/Calgary-Sud-Ouest" if district_code == 48008 & election == "2006 Canadian federal election"
replace district_name = "Calgary West/Calgary-Ouest" if district_code == 48009 & election == "2006 Canadian federal election"
replace district_name = "Crowfoot" if district_code == 48010 & election == "2006 Canadian federal election"
replace district_name = "Edmonton--Mill Woods--Beaumont" if district_code == 48011 & election == "2006 Canadian federal election"
replace district_name = "Edmonton Centre/Edmonton-Centre" if district_code == 48012 & election == "2006 Canadian federal election"
replace district_name = "Edmonton East/Edmonton-Est" if district_code == 48013 & election == "2006 Canadian federal election"
replace district_name = "Edmonton--Leduc" if district_code == 48014 & election == "2006 Canadian federal election"
replace district_name = "Edmonton--St. Albert" if district_code == 48015 & election == "2006 Canadian federal election"
replace district_name = "Edmonton--Sherwood Park" if district_code == 48016 & election == "2006 Canadian federal election"
replace district_name = "Edmonton--Spruce Grove" if district_code == 48017 & election == "2006 Canadian federal election"
replace district_name = "Edmonton--Strathcona" if district_code == 48018 & election == "2006 Canadian federal election"
replace district_name = "Lethbridge" if district_code == 48019 & election == "2006 Canadian federal election"
replace district_name = "Macleod" if district_code == 48020 & election == "2006 Canadian federal election"
replace district_name = "Medicine Hat" if district_code == 48021 & election == "2006 Canadian federal election"
replace district_name = "Peace River" if district_code == 48022 & election == "2006 Canadian federal election"
replace district_name = "Red Deer" if district_code == 48023 & election == "2006 Canadian federal election"
replace district_name = "Vegreville--Wainwright" if district_code == 48024 & election == "2006 Canadian federal election"
replace district_name = "Westlock--St. Paul" if district_code == 48025 & election == "2006 Canadian federal election"
replace district_name = "Wetaskiwin" if district_code == 48026 & election == "2006 Canadian federal election"
replace district_name = "Wild Rose" if district_code == 48027 & election == "2006 Canadian federal election"
replace district_name = "Yellowhead" if district_code == 48028 & election == "2006 Canadian federal election"
replace district_name = "Abbotsford" if district_code == 59001 & election == "2006 Canadian federal election"
replace district_name = "Burnaby--Douglas" if district_code == 59002 & election == "2006 Canadian federal election"
replace district_name = "Burnaby--New Westminster" if district_code == 59003 & election == "2006 Canadian federal election"
replace district_name = "Cariboo--Prince George" if district_code == 59004 & election == "2006 Canadian federal election"
replace district_name = "Chilliwack--Fraser Canyon" if district_code == 59005 & election == "2006 Canadian federal election"
replace district_name = "Delta--Richmond East/Delta--Richmond-Est" if district_code == 59006 & election == "2006 Canadian federal election"
replace district_name = "Pitt Meadows--Maple Ridge--Mission" if district_code == 59007 & election == "2006 Canadian federal election"
replace district_name = "Esquimalt--Juan de Fuca" if district_code == 59008 & election == "2006 Canadian federal election"
replace district_name = "Fleetwood--Port Kells" if district_code == 59009 & election == "2006 Canadian federal election"
replace district_name = "Kamloops--Thompson--Cariboo" if district_code == 59010 & election == "2006 Canadian federal election"
replace district_name = "Kelowna--Lake Country" if district_code == 59011 & election == "2006 Canadian federal election"
replace district_name = "Kootenay--Columbia" if district_code == 59012 & election == "2006 Canadian federal election"
replace district_name = "Langley" if district_code == 59013 & election == "2006 Canadian federal election"
replace district_name = "Nanaimo--Alberni" if district_code == 59014 & election == "2006 Canadian federal election"
replace district_name = "Nanaimo--Cowichan" if district_code == 59015 & election == "2006 Canadian federal election"
replace district_name = "Newton--North Delta/Newton--Delta-Nord" if district_code == 59016 & election == "2006 Canadian federal election"
replace district_name = "New Westminster--Coquitlam" if district_code == 59017 & election == "2006 Canadian federal election"
replace district_name = "Okanagan--Shuswap" if district_code == 59018 & election == "2006 Canadian federal election"
replace district_name = "North Vancouver" if district_code == 59019 & election == "2006 Canadian federal election"
replace district_name = "Okanagan--Coquihalla" if district_code == 59020 & election == "2006 Canadian federal election"
replace district_name = "Port Moody--Westwood--Port Coquitlam" if district_code == 59021 & election == "2006 Canadian federal election"
replace district_name = "Prince George--Peace River" if district_code == 59022 & election == "2006 Canadian federal election"
replace district_name = "Richmond" if district_code == 59023 & election == "2006 Canadian federal election"
replace district_name = "Saanich--Gulf Islands" if district_code == 59024 & election == "2006 Canadian federal election"
replace district_name = "Skeena--Bulkley Valley" if district_code == 59025 & election == "2006 Canadian federal election"
replace district_name = "British Columbia Southern Interior/Colombie-Britannique-Southern Interior" if district_code == 59026 & election == "2006 Canadian federal election"
replace district_name = "South Surrey--White Rock--Cloverdale/Surrey-Sud--White Rock--Cloverdale" if district_code == 59027 & election == "2006 Canadian federal election"
replace district_name = "Surrey North/Surrey-Nord" if district_code == 59028 & election == "2006 Canadian federal election"
replace district_name = "Vancouver Centre/Vancouver-Centre" if district_code == 59029 & election == "2006 Canadian federal election"
replace district_name = "Vancouver East/Vancouver-Est" if district_code == 59030 & election == "2006 Canadian federal election"
replace district_name = "Vancouver Island North/Île de Vancouver-Nord" if district_code == 59031 & election == "2006 Canadian federal election"
replace district_name = "Vancouver Kingsway" if district_code == 59032 & election == "2006 Canadian federal election"
replace district_name = "Vancouver Quadra" if district_code == 59033 & election == "2006 Canadian federal election"
replace district_name = "Vancouver South/Vancouver-Sud" if district_code == 59034 & election == "2006 Canadian federal election"
replace district_name = "Victoria" if district_code == 59035 & election == "2006 Canadian federal election"
replace district_name = "West Vancouver--Sunshine Coast--Sea to Sky Country" if district_code == 59036 & election == "2006 Canadian federal election"
replace district_name = "Yukon" if district_code == 60001 & election == "2006 Canadian federal election"
replace district_name = "Western Arctic" if district_code == 61001 & election == "2006 Canadian federal election"
replace district_name = "Nunavut" if district_code == 62001 & election == "2006 Canadian federal election"
replace district_name = "Avalon" if district_code == 10001 & election == "2008 Canadian federal election"
replace district_name = "Bonavista--Gander--Grand Falls--Windsor" if district_code == 10002 & election == "2008 Canadian federal election"
replace district_name = "Humber--St. Barbe--Baie Verte" if district_code == 10003 & election == "2008 Canadian federal election"
replace district_name = "Labrador" if district_code == 10004 & election == "2008 Canadian federal election"
replace district_name = "Random--Burin--St. George's" if district_code == 10005 & election == "2008 Canadian federal election"
replace district_name = "St. John's East/St. John's-Est" if district_code == 10006 & election == "2008 Canadian federal election"
replace district_name = "St. John's South--Mount Pearl/St. John's-Sud--Mount Pearl" if district_code == 10007 & election == "2008 Canadian federal election"
replace district_name = "Cardigan" if district_code == 11001 & election == "2008 Canadian federal election"
replace district_name = "Charlottetown" if district_code == 11002 & election == "2008 Canadian federal election"
replace district_name = "Egmont" if district_code == 11003 & election == "2008 Canadian federal election"
replace district_name = "Malpeque" if district_code == 11004 & election == "2008 Canadian federal election"
replace district_name = "Cape Breton--Canso" if district_code == 12001 & election == "2008 Canadian federal election"
replace district_name = "Central Nova/Nova-Centre" if district_code == 12002 & election == "2008 Canadian federal election"
replace district_name = "Dartmouth--Cole Harbour" if district_code == 12003 & election == "2008 Canadian federal election"
replace district_name = "Halifax" if district_code == 12004 & election == "2008 Canadian federal election"
replace district_name = "Halifax West/Halifax-Ouest" if district_code == 12005 & election == "2008 Canadian federal election"
replace district_name = "Kings--Hants" if district_code == 12006 & election == "2008 Canadian federal election"
replace district_name = "Cumberland--Colchester--Musquodoboit Valley" if district_code == 12007 & election == "2008 Canadian federal election"
replace district_name = "Sackville--Eastern Shore" if district_code == 12008 & election == "2008 Canadian federal election"
replace district_name = "South Shore--St. Margaret's" if district_code == 12009 & election == "2008 Canadian federal election"
replace district_name = "Sydney--Victoria" if district_code == 12010 & election == "2008 Canadian federal election"
replace district_name = "West Nova/Nova-Ouest" if district_code == 12011 & election == "2008 Canadian federal election"
replace district_name = "Acadie--Bathurst" if district_code == 13001 & election == "2008 Canadian federal election"
replace district_name = "Beauséjour" if district_code == 13002 & election == "2008 Canadian federal election"
replace district_name = "Fredericton" if district_code == 13003 & election == "2008 Canadian federal election"
replace district_name = "Fundy Royal" if district_code == 13004 & election == "2008 Canadian federal election"
replace district_name = "Madawaska--Restigouche" if district_code == 13005 & election == "2008 Canadian federal election"
replace district_name = "Miramichi" if district_code == 13006 & election == "2008 Canadian federal election"
replace district_name = "Moncton--Riverview--Dieppe" if district_code == 13007 & election == "2008 Canadian federal election"
replace district_name = "New Brunswick Southwest/Nouveau-Brunswick-Sud-Ouest" if district_code == 13008 & election == "2008 Canadian federal election"
replace district_name = "Saint John" if district_code == 13009 & election == "2008 Canadian federal election"
replace district_name = "Tobique--Mactaquac" if district_code == 13010 & election == "2008 Canadian federal election"
replace district_name = "Abitibi--Témiscamingue" if district_code == 24001 & election == "2008 Canadian federal election"
replace district_name = "Ahuntsic" if district_code == 24002 & election == "2008 Canadian federal election"
replace district_name = "Alfred-Pellan" if district_code == 24003 & election == "2008 Canadian federal election"
replace district_name = "Argenteuil--Papineau--Mirabel" if district_code == 24004 & election == "2008 Canadian federal election"
replace district_name = "Beauce" if district_code == 24005 & election == "2008 Canadian federal election"
replace district_name = "Beauharnois--Salaberry" if district_code == 24006 & election == "2008 Canadian federal election"
replace district_name = "Beauport--Limoilou" if district_code == 24007 & election == "2008 Canadian federal election"
replace district_name = "Berthier--Maskinongé" if district_code == 24008 & election == "2008 Canadian federal election"
replace district_name = "Bourassa" if district_code == 24009 & election == "2008 Canadian federal election"
replace district_name = "Brome--Missisquoi" if district_code == 24010 & election == "2008 Canadian federal election"
replace district_name = "Brossard--La Prairie" if district_code == 24011 & election == "2008 Canadian federal election"
replace district_name = "Chambly--Borduas" if district_code == 24012 & election == "2008 Canadian federal election"
replace district_name = "Charlesbourg--Haute-Saint-Charles" if district_code == 24013 & election == "2008 Canadian federal election"
replace district_name = "Montmorency--Charlevoix--Haute-Côte-Nord" if district_code == 24014 & election == "2008 Canadian federal election"
replace district_name = "Châteauguay--Saint-Constant" if district_code == 24015 & election == "2008 Canadian federal election"
replace district_name = "Chicoutimi--Le Fjord" if district_code == 24016 & election == "2008 Canadian federal election"
replace district_name = "Compton--Stanstead" if district_code == 24017 & election == "2008 Canadian federal election"
replace district_name = "Drummond" if district_code == 24018 & election == "2008 Canadian federal election"
replace district_name = "Gaspésie--Îles-de-la-Madeleine" if district_code == 24019 & election == "2008 Canadian federal election"
replace district_name = "Gatineau" if district_code == 24020 & election == "2008 Canadian federal election"
replace district_name = "Hochelaga" if district_code == 24021 & election == "2008 Canadian federal election"
replace district_name = "Honoré-Mercier" if district_code == 24022 & election == "2008 Canadian federal election"
replace district_name = "Hull--Aylmer" if district_code == 24023 & election == "2008 Canadian federal election"
replace district_name = "Jeanne-Le Ber" if district_code == 24024 & election == "2008 Canadian federal election"
replace district_name = "Joliette" if district_code == 24025 & election == "2008 Canadian federal election"
replace district_name = "Jonquière--Alma" if district_code == 24026 & election == "2008 Canadian federal election"
replace district_name = "Lac-Saint-Louis" if district_code == 24027 & election == "2008 Canadian federal election"
replace district_name = "La Pointe-de-l'Île" if district_code == 24028 & election == "2008 Canadian federal election"
replace district_name = "LaSalle--Émard" if district_code == 24029 & election == "2008 Canadian federal election"
replace district_name = "Laurentides--Labelle" if district_code == 24030 & election == "2008 Canadian federal election"
replace district_name = "Laurier--Sainte-Marie" if district_code == 24031 & election == "2008 Canadian federal election"
replace district_name = "Laval" if district_code == 24032 & election == "2008 Canadian federal election"
replace district_name = "Laval--Les Îles" if district_code == 24033 & election == "2008 Canadian federal election"
replace district_name = "Lévis--Bellechasse" if district_code == 24034 & election == "2008 Canadian federal election"
replace district_name = "Longueuil--Pierre-Boucher" if district_code == 24035 & election == "2008 Canadian federal election"
replace district_name = "Lotbinière--Chutes-de-la-Chaudière" if district_code == 24036 & election == "2008 Canadian federal election"
replace district_name = "Louis-Hébert" if district_code == 24037 & election == "2008 Canadian federal election"
replace district_name = "Louis-Saint-Laurent" if district_code == 24038 & election == "2008 Canadian federal election"
replace district_name = "Manicouagan" if district_code == 24039 & election == "2008 Canadian federal election"
replace district_name = "Marc-Aurèle-Fortin" if district_code == 24040 & election == "2008 Canadian federal election"
replace district_name = "Haute-Gaspésie--La Mitis--Matane--Matapédia" if district_code == 24041 & election == "2008 Canadian federal election"
replace district_name = "Mégantic--L'Érable" if district_code == 24042 & election == "2008 Canadian federal election"
replace district_name = "Montcalm" if district_code == 24043 & election == "2008 Canadian federal election"
replace district_name = "Mount Royal/Mont-Royal" if district_code == 24044 & election == "2008 Canadian federal election"
replace district_name = "Notre-Dame-de-Grâce--Lachine" if district_code == 24045 & election == "2008 Canadian federal election"
replace district_name = "Abitibi--Baie-James--Nunavik--Eeyou" if district_code == 24046 & election == "2008 Canadian federal election"
replace district_name = "Outremont" if district_code == 24047 & election == "2008 Canadian federal election"
replace district_name = "Papineau" if district_code == 24048 & election == "2008 Canadian federal election"
replace district_name = "Pierrefonds--Dollard" if district_code == 24049 & election == "2008 Canadian federal election"
replace district_name = "Pontiac" if district_code == 24050 & election == "2008 Canadian federal election"
replace district_name = "Portneuf--Jacques-Cartier" if district_code == 24051 & election == "2008 Canadian federal election"
replace district_name = "Québec" if district_code == 24052 & election == "2008 Canadian federal election"
replace district_name = "Repentigny" if district_code == 24053 & election == "2008 Canadian federal election"
replace district_name = "Bas-Richelieu--Nicolet--Bécancour" if district_code == 24054 & election == "2008 Canadian federal election"
replace district_name = "Richmond--Arthabaska" if district_code == 24055 & election == "2008 Canadian federal election"
replace district_name = "Rimouski-Neigette--Témiscouata--Les Basques" if district_code == 24056 & election == "2008 Canadian federal election"
replace district_name = "Rivière-des-Mille-Îles" if district_code == 24057 & election == "2008 Canadian federal election"
replace district_name = "Montmagny--L'Islet--Kamouraska--Rivière-du-Loup" if district_code == 24058 & election == "2008 Canadian federal election"
replace district_name = "Rivière-du-Nord" if district_code == 24059 & election == "2008 Canadian federal election"
replace district_name = "Roberval--Lac-Saint-Jean" if district_code == 24060 & election == "2008 Canadian federal election"
replace district_name = "Rosemont--La Petite-Patrie" if district_code == 24061 & election == "2008 Canadian federal election"
replace district_name = "Saint-Bruno--Saint-Hubert" if district_code == 24062 & election == "2008 Canadian federal election"
replace district_name = "Saint-Hyacinthe--Bagot" if district_code == 24063 & election == "2008 Canadian federal election"
replace district_name = "Saint-Jean" if district_code == 24064 & election == "2008 Canadian federal election"
replace district_name = "Saint-Lambert" if district_code == 24065 & election == "2008 Canadian federal election"
replace district_name = "Saint-Laurent--Cartierville" if district_code == 24066 & election == "2008 Canadian federal election"
replace district_name = "Saint-Léonard--Saint-Michel" if district_code == 24067 & election == "2008 Canadian federal election"
replace district_name = "Saint-Maurice--Champlain" if district_code == 24068 & election == "2008 Canadian federal election"
replace district_name = "Shefford" if district_code == 24069 & election == "2008 Canadian federal election"
replace district_name = "Sherbrooke" if district_code == 24070 & election == "2008 Canadian federal election"
replace district_name = "Terrebonne--Blainville" if district_code == 24071 & election == "2008 Canadian federal election"
replace district_name = "Trois-Rivières" if district_code == 24072 & election == "2008 Canadian federal election"
replace district_name = "Vaudreuil-Soulanges" if district_code == 24073 & election == "2008 Canadian federal election"
replace district_name = "Verchères--Les Patriotes" if district_code == 24074 & election == "2008 Canadian federal election"
replace district_name = "Westmount--Ville-Marie" if district_code == 24075 & election == "2008 Canadian federal election"
replace district_name = "Ajax--Pickering" if district_code == 35001 & election == "2008 Canadian federal election"
replace district_name = "Algoma--Manitoulin--Kapuskasing" if district_code == 35002 & election == "2008 Canadian federal election"
replace district_name = "Ancaster--Dundas--Flamborough--Westdale" if district_code == 35003 & election == "2008 Canadian federal election"
replace district_name = "Barrie" if district_code == 35004 & election == "2008 Canadian federal election"
replace district_name = "Beaches--East York" if district_code == 35005 & election == "2008 Canadian federal election"
replace district_name = "Bramalea--Gore--Malton" if district_code == 35006 & election == "2008 Canadian federal election"
replace district_name = "Brampton--Springdale" if district_code == 35007 & election == "2008 Canadian federal election"
replace district_name = "Brampton West/Brampton-Ouest" if district_code == 35008 & election == "2008 Canadian federal election"
replace district_name = "Brant" if district_code == 35009 & election == "2008 Canadian federal election"
replace district_name = "Burlington" if district_code == 35010 & election == "2008 Canadian federal election"
replace district_name = "Cambridge" if district_code == 35011 & election == "2008 Canadian federal election"
replace district_name = "Carleton--Mississippi Mills" if district_code == 35012 & election == "2008 Canadian federal election"
replace district_name = "Chatham-Kent--Essex" if district_code == 35013 & election == "2008 Canadian federal election"
replace district_name = "Durham" if district_code == 35014 & election == "2008 Canadian federal election"
replace district_name = "Davenport" if district_code == 35015 & election == "2008 Canadian federal election"
replace district_name = "Don Valley East/Don Valley-Est" if district_code == 35016 & election == "2008 Canadian federal election"
replace district_name = "Don Valley West/Don Valley-Ouest" if district_code == 35017 & election == "2008 Canadian federal election"
replace district_name = "Dufferin--Caledon" if district_code == 35018 & election == "2008 Canadian federal election"
replace district_name = "Eglinton--Lawrence" if district_code == 35019 & election == "2008 Canadian federal election"
replace district_name = "Elgin--Middlesex--London" if district_code == 35020 & election == "2008 Canadian federal election"
replace district_name = "Essex" if district_code == 35021 & election == "2008 Canadian federal election"
replace district_name = "Etobicoke Centre/Etobicoke-Centre" if district_code == 35022 & election == "2008 Canadian federal election"
replace district_name = "Etobicoke--Lakeshore" if district_code == 35023 & election == "2008 Canadian federal election"
replace district_name = "Etobicoke North/Etobicoke-Nord" if district_code == 35024 & election == "2008 Canadian federal election"
replace district_name = "Glengarry--Prescott--Russell" if district_code == 35025 & election == "2008 Canadian federal election"
replace district_name = "Bruce--Grey--Owen Sound" if district_code == 35026 & election == "2008 Canadian federal election"
replace district_name = "Guelph" if district_code == 35027 & election == "2008 Canadian federal election"
replace district_name = "Haldimand--Norfolk" if district_code == 35028 & election == "2008 Canadian federal election"
replace district_name = "Haliburton--Kawartha Lakes--Brock" if district_code == 35029 & election == "2008 Canadian federal election"
replace district_name = "Halton" if district_code == 35030 & election == "2008 Canadian federal election"
replace district_name = "Hamilton Centre/Hamilton-Centre" if district_code == 35031 & election == "2008 Canadian federal election"
replace district_name = "Hamilton East--Stoney Creek/Hamilton-Est--Stoney Creek" if district_code == 35032 & election == "2008 Canadian federal election"
replace district_name = "Hamilton Mountain" if district_code == 35033 & election == "2008 Canadian federal election"
replace district_name = "Huron--Bruce" if district_code == 35034 & election == "2008 Canadian federal election"
replace district_name = "Kenora" if district_code == 35035 & election == "2008 Canadian federal election"
replace district_name = "Kingston and the Islands/Kingston et les Îles" if district_code == 35036 & election == "2008 Canadian federal election"
replace district_name = "Kitchener Centre/Kitchener-Centre" if district_code == 35037 & election == "2008 Canadian federal election"
replace district_name = "Kitchener--Conestoga" if district_code == 35038 & election == "2008 Canadian federal election"
replace district_name = "Kitchener--Waterloo" if district_code == 35039 & election == "2008 Canadian federal election"
replace district_name = "Lanark--Frontenac--Lennox and Addington" if district_code == 35040 & election == "2008 Canadian federal election"
replace district_name = "Leeds--Grenville" if district_code == 35041 & election == "2008 Canadian federal election"
replace district_name = "London--Fanshawe" if district_code == 35042 & election == "2008 Canadian federal election"
replace district_name = "London North Centre/London-Centre-Nord" if district_code == 35043 & election == "2008 Canadian federal election"
replace district_name = "London West/London-Ouest" if district_code == 35044 & election == "2008 Canadian federal election"
replace district_name = "Markham--Unionville" if district_code == 35045 & election == "2008 Canadian federal election"
replace district_name = "Lambton--Kent--Middlesex" if district_code == 35046 & election == "2008 Canadian federal election"
replace district_name = "Mississauga--Brampton South/Mississauga--Brampton-Sud" if district_code == 35047 & election == "2008 Canadian federal election"
replace district_name = "Mississauga East--Cooksville/Mississauga-Est--Cooksville" if district_code == 35048 & election == "2008 Canadian federal election"
replace district_name = "Mississauga--Erindale" if district_code == 35049 & election == "2008 Canadian federal election"
replace district_name = "Mississauga South/Mississauga-Sud" if district_code == 35050 & election == "2008 Canadian federal election"
replace district_name = "Mississauga--Streetsville" if district_code == 35051 & election == "2008 Canadian federal election"
replace district_name = "Nepean--Carleton" if district_code == 35052 & election == "2008 Canadian federal election"
replace district_name = "Newmarket--Aurora" if district_code == 35053 & election == "2008 Canadian federal election"
replace district_name = "Niagara Falls" if district_code == 35054 & election == "2008 Canadian federal election"
replace district_name = "Niagara West--Glanbrook/Niagara-Ouest--Glanbrook" if district_code == 35055 & election == "2008 Canadian federal election"
replace district_name = "Nickel Belt" if district_code == 35056 & election == "2008 Canadian federal election"
replace district_name = "Nipissing--Timiskaming" if district_code == 35057 & election == "2008 Canadian federal election"
replace district_name = "Northumberland--Quinte West" if district_code == 35058 & election == "2008 Canadian federal election"
replace district_name = "Oak Ridges--Markham" if district_code == 35059 & election == "2008 Canadian federal election"
replace district_name = "Oakville" if district_code == 35060 & election == "2008 Canadian federal election"
replace district_name = "Oshawa" if district_code == 35061 & election == "2008 Canadian federal election"
replace district_name = "Ottawa Centre/Ottawa-Centre" if district_code == 35062 & election == "2008 Canadian federal election"
replace district_name = "Ottawa--Orléans" if district_code == 35063 & election == "2008 Canadian federal election"
replace district_name = "Ottawa South/Ottawa-Sud" if district_code == 35064 & election == "2008 Canadian federal election"
replace district_name = "Ottawa--Vanier" if district_code == 35065 & election == "2008 Canadian federal election"
replace district_name = "Ottawa West--Nepean/Ottawa-Ouest--Nepean" if district_code == 35066 & election == "2008 Canadian federal election"
replace district_name = "Oxford" if district_code == 35067 & election == "2008 Canadian federal election"
replace district_name = "Parkdale--High Park" if district_code == 35068 & election == "2008 Canadian federal election"
replace district_name = "Parry Sound--Muskoka" if district_code == 35069 & election == "2008 Canadian federal election"
replace district_name = "Perth--Wellington" if district_code == 35070 & election == "2008 Canadian federal election"
replace district_name = "Peterborough" if district_code == 35071 & election == "2008 Canadian federal election"
replace district_name = "Pickering--Scarborough East/Pickering--Scarborough-Est" if district_code == 35072 & election == "2008 Canadian federal election"
replace district_name = "Prince Edward--Hastings" if district_code == 35073 & election == "2008 Canadian federal election"
replace district_name = "Renfrew--Nipissing--Pembroke" if district_code == 35074 & election == "2008 Canadian federal election"
replace district_name = "Richmond Hill" if district_code == 35075 & election == "2008 Canadian federal election"
replace district_name = "St. Catharines" if district_code == 35076 & election == "2008 Canadian federal election"
replace district_name = "St. Paul's" if district_code == 35077 & election == "2008 Canadian federal election"
replace district_name = "Sarnia--Lambton" if district_code == 35078 & election == "2008 Canadian federal election"
replace district_name = "Sault Ste. Marie" if district_code == 35079 & election == "2008 Canadian federal election"
replace district_name = "Scarborough--Agincourt" if district_code == 35080 & election == "2008 Canadian federal election"
replace district_name = "Scarborough Centre/Scarborough-Centre" if district_code == 35081 & election == "2008 Canadian federal election"
replace district_name = "Scarborough--Guildwood" if district_code == 35082 & election == "2008 Canadian federal election"
replace district_name = "Scarborough--Rouge River" if district_code == 35083 & election == "2008 Canadian federal election"
replace district_name = "Scarborough Southwest/Scarborough-Sud-Ouest" if district_code == 35084 & election == "2008 Canadian federal election"
replace district_name = "Simcoe--Grey" if district_code == 35085 & election == "2008 Canadian federal election"
replace district_name = "Simcoe North/Simcoe-Nord" if district_code == 35086 & election == "2008 Canadian federal election"
replace district_name = "Stormont--Dundas--South Glengarry" if district_code == 35087 & election == "2008 Canadian federal election"
replace district_name = "Sudbury" if district_code == 35088 & election == "2008 Canadian federal election"
replace district_name = "Thornhill" if district_code == 35089 & election == "2008 Canadian federal election"
replace district_name = "Thunder Bay--Rainy River" if district_code == 35090 & election == "2008 Canadian federal election"
replace district_name = "Thunder Bay--Superior North/Thunder Bay--Superior-Nord" if district_code == 35091 & election == "2008 Canadian federal election"
replace district_name = "Timmins--James Bay/Timmins--Baie James" if district_code == 35092 & election == "2008 Canadian federal election"
replace district_name = "Toronto Centre/Toronto-Centre" if district_code == 35093 & election == "2008 Canadian federal election"
replace district_name = "Toronto--Danforth" if district_code == 35094 & election == "2008 Canadian federal election"
replace district_name = "Trinity--Spadina" if district_code == 35095 & election == "2008 Canadian federal election"
replace district_name = "Vaughan" if district_code == 35096 & election == "2008 Canadian federal election"
replace district_name = "Welland" if district_code == 35097 & election == "2008 Canadian federal election"
replace district_name = "Wellington--Halton Hills" if district_code == 35098 & election == "2008 Canadian federal election"
replace district_name = "Whitby--Oshawa" if district_code == 35099 & election == "2008 Canadian federal election"
replace district_name = "Willowdale" if district_code == 35100 & election == "2008 Canadian federal election"
replace district_name = "Windsor--Tecumseh" if district_code == 35101 & election == "2008 Canadian federal election"
replace district_name = "Windsor West/Windsor-Ouest" if district_code == 35102 & election == "2008 Canadian federal election"
replace district_name = "York Centre/York-Centre" if district_code == 35103 & election == "2008 Canadian federal election"
replace district_name = "York--Simcoe" if district_code == 35104 & election == "2008 Canadian federal election"
replace district_name = "York South--Weston/York-Sud--Weston" if district_code == 35105 & election == "2008 Canadian federal election"
replace district_name = "York West/York-Ouest" if district_code == 35106 & election == "2008 Canadian federal election"
replace district_name = "Brandon--Souris" if district_code == 46001 & election == "2008 Canadian federal election"
replace district_name = "Charleswood--St. James--Assiniboia" if district_code == 46002 & election == "2008 Canadian federal election"
replace district_name = "Churchill" if district_code == 46003 & election == "2008 Canadian federal election"
replace district_name = "Dauphin--Swan River--Marquette" if district_code == 46004 & election == "2008 Canadian federal election"
replace district_name = "Elmwood--Transcona" if district_code == 46005 & election == "2008 Canadian federal election"
replace district_name = "Kildonan--St. Paul" if district_code == 46006 & election == "2008 Canadian federal election"
replace district_name = "Portage--Lisgar" if district_code == 46007 & election == "2008 Canadian federal election"
replace district_name = "Provencher" if district_code == 46008 & election == "2008 Canadian federal election"
replace district_name = "Saint Boniface/Saint-Boniface" if district_code == 46009 & election == "2008 Canadian federal election"
replace district_name = "Selkirk--Interlake" if district_code == 46010 & election == "2008 Canadian federal election"
replace district_name = "Winnipeg Centre/Winnipeg-Centre" if district_code == 46011 & election == "2008 Canadian federal election"
replace district_name = "Winnipeg North/Winnipeg-Nord" if district_code == 46012 & election == "2008 Canadian federal election"
replace district_name = "Winnipeg South/Winnipeg-Sud" if district_code == 46013 & election == "2008 Canadian federal election"
replace district_name = "Winnipeg South Centre/Winnipeg-Centre-Sud" if district_code == 46014 & election == "2008 Canadian federal election"
replace district_name = "Battlefords--Lloydminster" if district_code == 47001 & election == "2008 Canadian federal election"
replace district_name = "Blackstrap" if district_code == 47002 & election == "2008 Canadian federal election"
replace district_name = "Desnethé--Missinippi--Churchill River/Desnethé--Missinippi--Rivière Churchill" if district_code == 47003 & election == "2008 Canadian federal election"
replace district_name = "Cypress Hills--Grasslands" if district_code == 47004 & election == "2008 Canadian federal election"
replace district_name = "Palliser" if district_code == 47005 & election == "2008 Canadian federal election"
replace district_name = "Prince Albert" if district_code == 47006 & election == "2008 Canadian federal election"
replace district_name = "Regina--Lumsden--Lake Centre" if district_code == 47007 & election == "2008 Canadian federal election"
replace district_name = "Regina--Qu'Appelle" if district_code == 47008 & election == "2008 Canadian federal election"
replace district_name = "Saskatoon--Humboldt" if district_code == 47009 & election == "2008 Canadian federal election"
replace district_name = "Saskatoon--Rosetown--Biggar" if district_code == 47010 & election == "2008 Canadian federal election"
replace district_name = "Saskatoon--Wanuskewin" if district_code == 47011 & election == "2008 Canadian federal election"
replace district_name = "Souris--Moose Mountain" if district_code == 47012 & election == "2008 Canadian federal election"
replace district_name = "Wascana" if district_code == 47013 & election == "2008 Canadian federal election"
replace district_name = "Yorkton--Melville" if district_code == 47014 & election == "2008 Canadian federal election"
replace district_name = "Fort McMurray--Athabasca" if district_code == 48001 & election == "2008 Canadian federal election"
replace district_name = "Calgary East/Calgary-Est" if district_code == 48002 & election == "2008 Canadian federal election"
replace district_name = "Calgary Centre-North/Calgary-Centre-Nord" if district_code == 48003 & election == "2008 Canadian federal election"
replace district_name = "Calgary Northeast/Calgary-Nord-Est" if district_code == 48004 & election == "2008 Canadian federal election"
replace district_name = "Calgary--Nose Hill" if district_code == 48005 & election == "2008 Canadian federal election"
replace district_name = "Calgary Centre/Calgary-Centre" if district_code == 48006 & election == "2008 Canadian federal election"
replace district_name = "Calgary Southeast/Calgary-Sud-Est" if district_code == 48007 & election == "2008 Canadian federal election"
replace district_name = "Calgary Southwest/Calgary-Sud-Ouest" if district_code == 48008 & election == "2008 Canadian federal election"
replace district_name = "Calgary West/Calgary-Ouest" if district_code == 48009 & election == "2008 Canadian federal election"
replace district_name = "Crowfoot" if district_code == 48010 & election == "2008 Canadian federal election"
replace district_name = "Edmonton--Mill Woods--Beaumont" if district_code == 48011 & election == "2008 Canadian federal election"
replace district_name = "Edmonton Centre/Edmonton-Centre" if district_code == 48012 & election == "2008 Canadian federal election"
replace district_name = "Edmonton East/Edmonton-Est" if district_code == 48013 & election == "2008 Canadian federal election"
replace district_name = "Edmonton--Leduc" if district_code == 48014 & election == "2008 Canadian federal election"
replace district_name = "Edmonton--St. Albert" if district_code == 48015 & election == "2008 Canadian federal election"
replace district_name = "Edmonton--Sherwood Park" if district_code == 48016 & election == "2008 Canadian federal election"
replace district_name = "Edmonton--Spruce Grove" if district_code == 48017 & election == "2008 Canadian federal election"
replace district_name = "Edmonton--Strathcona" if district_code == 48018 & election == "2008 Canadian federal election"
replace district_name = "Lethbridge" if district_code == 48019 & election == "2008 Canadian federal election"
replace district_name = "Macleod" if district_code == 48020 & election == "2008 Canadian federal election"
replace district_name = "Medicine Hat" if district_code == 48021 & election == "2008 Canadian federal election"
replace district_name = "Peace River" if district_code == 48022 & election == "2008 Canadian federal election"
replace district_name = "Red Deer" if district_code == 48023 & election == "2008 Canadian federal election"
replace district_name = "Vegreville--Wainwright" if district_code == 48024 & election == "2008 Canadian federal election"
replace district_name = "Westlock--St. Paul" if district_code == 48025 & election == "2008 Canadian federal election"
replace district_name = "Wetaskiwin" if district_code == 48026 & election == "2008 Canadian federal election"
replace district_name = "Wild Rose" if district_code == 48027 & election == "2008 Canadian federal election"
replace district_name = "Yellowhead" if district_code == 48028 & election == "2008 Canadian federal election"
replace district_name = "Abbotsford" if district_code == 59001 & election == "2008 Canadian federal election"
replace district_name = "Burnaby--Douglas" if district_code == 59002 & election == "2008 Canadian federal election"
replace district_name = "Burnaby--New Westminster" if district_code == 59003 & election == "2008 Canadian federal election"
replace district_name = "Cariboo--Prince George" if district_code == 59004 & election == "2008 Canadian federal election"
replace district_name = "Chilliwack--Fraser Canyon" if district_code == 59005 & election == "2008 Canadian federal election"
replace district_name = "Delta--Richmond East/Delta--Richmond-Est" if district_code == 59006 & election == "2008 Canadian federal election"
replace district_name = "Pitt Meadows--Maple Ridge--Mission" if district_code == 59007 & election == "2008 Canadian federal election"
replace district_name = "Esquimalt--Juan de Fuca" if district_code == 59008 & election == "2008 Canadian federal election"
replace district_name = "Fleetwood--Port Kells" if district_code == 59009 & election == "2008 Canadian federal election"
replace district_name = "Kamloops--Thompson--Cariboo" if district_code == 59010 & election == "2008 Canadian federal election"
replace district_name = "Kelowna--Lake Country" if district_code == 59011 & election == "2008 Canadian federal election"
replace district_name = "Kootenay--Columbia" if district_code == 59012 & election == "2008 Canadian federal election"
replace district_name = "Langley" if district_code == 59013 & election == "2008 Canadian federal election"
replace district_name = "Nanaimo--Alberni" if district_code == 59014 & election == "2008 Canadian federal election"
replace district_name = "Nanaimo--Cowichan" if district_code == 59015 & election == "2008 Canadian federal election"
replace district_name = "Newton--North Delta/Newton--Delta-Nord" if district_code == 59016 & election == "2008 Canadian federal election"
replace district_name = "New Westminster--Coquitlam" if district_code == 59017 & election == "2008 Canadian federal election"
replace district_name = "Okanagan--Shuswap" if district_code == 59018 & election == "2008 Canadian federal election"
replace district_name = "North Vancouver" if district_code == 59019 & election == "2008 Canadian federal election"
replace district_name = "Okanagan--Coquihalla" if district_code == 59020 & election == "2008 Canadian federal election"
replace district_name = "Port Moody--Westwood--Port Coquitlam" if district_code == 59021 & election == "2008 Canadian federal election"
replace district_name = "Prince George--Peace River" if district_code == 59022 & election == "2008 Canadian federal election"
replace district_name = "Richmond" if district_code == 59023 & election == "2008 Canadian federal election"
replace district_name = "Saanich--Gulf Islands" if district_code == 59024 & election == "2008 Canadian federal election"
replace district_name = "Skeena--Bulkley Valley" if district_code == 59025 & election == "2008 Canadian federal election"
replace district_name = "British Columbia Southern Interior/Colombie-Britannique-Southern Interior" if district_code == 59026 & election == "2008 Canadian federal election"
replace district_name = "South Surrey--White Rock--Cloverdale/Surrey-Sud--White Rock--Cloverdale" if district_code == 59027 & election == "2008 Canadian federal election"
replace district_name = "Surrey North/Surrey-Nord" if district_code == 59028 & election == "2008 Canadian federal election"
replace district_name = "Vancouver Centre/Vancouver-Centre" if district_code == 59029 & election == "2008 Canadian federal election"
replace district_name = "Vancouver East/Vancouver-Est" if district_code == 59030 & election == "2008 Canadian federal election"
replace district_name = "Vancouver Island North/Île de Vancouver-Nord" if district_code == 59031 & election == "2008 Canadian federal election"
replace district_name = "Vancouver Kingsway" if district_code == 59032 & election == "2008 Canadian federal election"
replace district_name = "Vancouver Quadra" if district_code == 59033 & election == "2008 Canadian federal election"
replace district_name = "Vancouver South/Vancouver-Sud" if district_code == 59034 & election == "2008 Canadian federal election"
replace district_name = "Victoria" if district_code == 59035 & election == "2008 Canadian federal election"
replace district_name = "West Vancouver--Sunshine Coast--Sea to Sky Country" if district_code == 59036 & election == "2008 Canadian federal election"
replace district_name = "Yukon" if district_code == 60001 & election == "2008 Canadian federal election"
replace district_name = "Western Arctic" if district_code == 61001 & election == "2008 Canadian federal election"
replace district_name = "Nunavut" if district_code == 62001 & election == "2008 Canadian federal election"
replace district_name = "Avalon" if district_code == 10001 & election == "2011 Canadian federal election"
replace district_name = "Bonavista--Gander--Grand Falls--Windsor" if district_code == 10002 & election == "2011 Canadian federal election"
replace district_name = "Humber--St. Barbe--Baie Verte" if district_code == 10003 & election == "2011 Canadian federal election"
replace district_name = "Labrador" if district_code == 10004 & election == "2011 Canadian federal election"
replace district_name = "Random--Burin--St. George's" if district_code == 10005 & election == "2011 Canadian federal election"
replace district_name = "St. John's East/St. John's-Est" if district_code == 10006 & election == "2011 Canadian federal election"
replace district_name = "St. John's South--Mount Pearl/St. John's-Sud--Mount Pearl" if district_code == 10007 & election == "2011 Canadian federal election"
replace district_name = "Cardigan" if district_code == 11001 & election == "2011 Canadian federal election"
replace district_name = "Charlottetown" if district_code == 11002 & election == "2011 Canadian federal election"
replace district_name = "Egmont" if district_code == 11003 & election == "2011 Canadian federal election"
replace district_name = "Malpeque" if district_code == 11004 & election == "2011 Canadian federal election"
replace district_name = "Cape Breton--Canso" if district_code == 12001 & election == "2011 Canadian federal election"
replace district_name = "Central Nova/Nova-Centre" if district_code == 12002 & election == "2011 Canadian federal election"
replace district_name = "Dartmouth--Cole Harbour" if district_code == 12003 & election == "2011 Canadian federal election"
replace district_name = "Halifax" if district_code == 12004 & election == "2011 Canadian federal election"
replace district_name = "Halifax West/Halifax-Ouest" if district_code == 12005 & election == "2011 Canadian federal election"
replace district_name = "Kings--Hants" if district_code == 12006 & election == "2011 Canadian federal election"
replace district_name = "Cumberland--Colchester--Musquodoboit Valley" if district_code == 12007 & election == "2011 Canadian federal election"
replace district_name = "Sackville--Eastern Shore" if district_code == 12008 & election == "2011 Canadian federal election"
replace district_name = "South Shore--St. Margaret's" if district_code == 12009 & election == "2011 Canadian federal election"
replace district_name = "Sydney--Victoria" if district_code == 12010 & election == "2011 Canadian federal election"
replace district_name = "West Nova/Nova-Ouest" if district_code == 12011 & election == "2011 Canadian federal election"
replace district_name = "Acadie--Bathurst" if district_code == 13001 & election == "2011 Canadian federal election"
replace district_name = "Beauséjour" if district_code == 13002 & election == "2011 Canadian federal election"
replace district_name = "Fredericton" if district_code == 13003 & election == "2011 Canadian federal election"
replace district_name = "Fundy Royal" if district_code == 13004 & election == "2011 Canadian federal election"
replace district_name = "Madawaska--Restigouche" if district_code == 13005 & election == "2011 Canadian federal election"
replace district_name = "Miramichi" if district_code == 13006 & election == "2011 Canadian federal election"
replace district_name = "Moncton--Riverview--Dieppe" if district_code == 13007 & election == "2011 Canadian federal election"
replace district_name = "New Brunswick Southwest/Nouveau-Brunswick-Sud-Ouest" if district_code == 13008 & election == "2011 Canadian federal election"
replace district_name = "Saint John" if district_code == 13009 & election == "2011 Canadian federal election"
replace district_name = "Tobique--Mactaquac" if district_code == 13010 & election == "2011 Canadian federal election"
replace district_name = "Abitibi--Témiscamingue" if district_code == 24001 & election == "2011 Canadian federal election"
replace district_name = "Ahuntsic" if district_code == 24002 & election == "2011 Canadian federal election"
replace district_name = "Alfred-Pellan" if district_code == 24003 & election == "2011 Canadian federal election"
replace district_name = "Argenteuil--Papineau--Mirabel" if district_code == 24004 & election == "2011 Canadian federal election"
replace district_name = "Beauce" if district_code == 24005 & election == "2011 Canadian federal election"
replace district_name = "Beauharnois--Salaberry" if district_code == 24006 & election == "2011 Canadian federal election"
replace district_name = "Beauport--Limoilou" if district_code == 24007 & election == "2011 Canadian federal election"
replace district_name = "Berthier--Maskinongé" if district_code == 24008 & election == "2011 Canadian federal election"
replace district_name = "Bourassa" if district_code == 24009 & election == "2011 Canadian federal election"
replace district_name = "Brome--Missisquoi" if district_code == 24010 & election == "2011 Canadian federal election"
replace district_name = "Brossard--La Prairie" if district_code == 24011 & election == "2011 Canadian federal election"
replace district_name = "Chambly--Borduas" if district_code == 24012 & election == "2011 Canadian federal election"
replace district_name = "Charlesbourg--Haute-Saint-Charles" if district_code == 24013 & election == "2011 Canadian federal election"
replace district_name = "Montmorency--Charlevoix--Haute-Côte-Nord" if district_code == 24014 & election == "2011 Canadian federal election"
replace district_name = "Châteauguay--Saint-Constant" if district_code == 24015 & election == "2011 Canadian federal election"
replace district_name = "Chicoutimi--Le Fjord" if district_code == 24016 & election == "2011 Canadian federal election"
replace district_name = "Compton--Stanstead" if district_code == 24017 & election == "2011 Canadian federal election"
replace district_name = "Drummond" if district_code == 24018 & election == "2011 Canadian federal election"
replace district_name = "Gaspésie--Îles-de-la-Madeleine" if district_code == 24019 & election == "2011 Canadian federal election"
replace district_name = "Gatineau" if district_code == 24020 & election == "2011 Canadian federal election"
replace district_name = "Hochelaga" if district_code == 24021 & election == "2011 Canadian federal election"
replace district_name = "Honoré-Mercier" if district_code == 24022 & election == "2011 Canadian federal election"
replace district_name = "Hull--Aylmer" if district_code == 24023 & election == "2011 Canadian federal election"
replace district_name = "Jeanne-Le Ber" if district_code == 24024 & election == "2011 Canadian federal election"
replace district_name = "Joliette" if district_code == 24025 & election == "2011 Canadian federal election"
replace district_name = "Jonquière--Alma" if district_code == 24026 & election == "2011 Canadian federal election"
replace district_name = "Lac-Saint-Louis" if district_code == 24027 & election == "2011 Canadian federal election"
replace district_name = "La Pointe-de-l'Île" if district_code == 24028 & election == "2011 Canadian federal election"
replace district_name = "LaSalle--Émard" if district_code == 24029 & election == "2011 Canadian federal election"
replace district_name = "Laurentides--Labelle" if district_code == 24030 & election == "2011 Canadian federal election"
replace district_name = "Laurier--Sainte-Marie" if district_code == 24031 & election == "2011 Canadian federal election"
replace district_name = "Laval" if district_code == 24032 & election == "2011 Canadian federal election"
replace district_name = "Laval--Les Îles" if district_code == 24033 & election == "2011 Canadian federal election"
replace district_name = "Lévis--Bellechasse" if district_code == 24034 & election == "2011 Canadian federal election"
replace district_name = "Longueuil--Pierre-Boucher" if district_code == 24035 & election == "2011 Canadian federal election"
replace district_name = "Lotbinière--Chutes-de-la-Chaudière" if district_code == 24036 & election == "2011 Canadian federal election"
replace district_name = "Louis-Hébert" if district_code == 24037 & election == "2011 Canadian federal election"
replace district_name = "Louis-Saint-Laurent" if district_code == 24038 & election == "2011 Canadian federal election"
replace district_name = "Manicouagan" if district_code == 24039 & election == "2011 Canadian federal election"
replace district_name = "Marc-Aurèle-Fortin" if district_code == 24040 & election == "2011 Canadian federal election"
replace district_name = "Haute-Gaspésie--La Mitis--Matane--Matapédia" if district_code == 24041 & election == "2011 Canadian federal election"
replace district_name = "Mégantic--L'Érable" if district_code == 24042 & election == "2011 Canadian federal election"
replace district_name = "Montcalm" if district_code == 24043 & election == "2011 Canadian federal election"
replace district_name = "Mount Royal/Mont-Royal" if district_code == 24044 & election == "2011 Canadian federal election"
replace district_name = "Notre-Dame-de-Grâce--Lachine" if district_code == 24045 & election == "2011 Canadian federal election"
replace district_name = "Abitibi--Baie-James--Nunavik--Eeyou" if district_code == 24046 & election == "2011 Canadian federal election"
replace district_name = "Outremont" if district_code == 24047 & election == "2011 Canadian federal election"
replace district_name = "Papineau" if district_code == 24048 & election == "2011 Canadian federal election"
replace district_name = "Pierrefonds--Dollard" if district_code == 24049 & election == "2011 Canadian federal election"
replace district_name = "Pontiac" if district_code == 24050 & election == "2011 Canadian federal election"
replace district_name = "Portneuf--Jacques-Cartier" if district_code == 24051 & election == "2011 Canadian federal election"
replace district_name = "Québec" if district_code == 24052 & election == "2011 Canadian federal election"
replace district_name = "Repentigny" if district_code == 24053 & election == "2011 Canadian federal election"
replace district_name = "Bas-Richelieu--Nicolet--Bécancour" if district_code == 24054 & election == "2011 Canadian federal election"
replace district_name = "Richmond--Arthabaska" if district_code == 24055 & election == "2011 Canadian federal election"
replace district_name = "Rimouski-Neigette--Témiscouata--Les Basques" if district_code == 24056 & election == "2011 Canadian federal election"
replace district_name = "Rivière-des-Mille-Îles" if district_code == 24057 & election == "2011 Canadian federal election"
replace district_name = "Montmagny--L'Islet--Kamouraska--Rivière-du-Loup" if district_code == 24058 & election == "2011 Canadian federal election"
replace district_name = "Rivière-du-Nord" if district_code == 24059 & election == "2011 Canadian federal election"
replace district_name = "Roberval--Lac-Saint-Jean" if district_code == 24060 & election == "2011 Canadian federal election"
replace district_name = "Rosemont--La Petite-Patrie" if district_code == 24061 & election == "2011 Canadian federal election"
replace district_name = "Saint-Bruno--Saint-Hubert" if district_code == 24062 & election == "2011 Canadian federal election"
replace district_name = "Saint-Hyacinthe--Bagot" if district_code == 24063 & election == "2011 Canadian federal election"
replace district_name = "Saint-Jean" if district_code == 24064 & election == "2011 Canadian federal election"
replace district_name = "Saint-Lambert" if district_code == 24065 & election == "2011 Canadian federal election"
replace district_name = "Saint-Laurent--Cartierville" if district_code == 24066 & election == "2011 Canadian federal election"
replace district_name = "Saint-Léonard--Saint-Michel" if district_code == 24067 & election == "2011 Canadian federal election"
replace district_name = "Saint-Maurice--Champlain" if district_code == 24068 & election == "2011 Canadian federal election"
replace district_name = "Shefford" if district_code == 24069 & election == "2011 Canadian federal election"
replace district_name = "Sherbrooke" if district_code == 24070 & election == "2011 Canadian federal election"
replace district_name = "Terrebonne--Blainville" if district_code == 24071 & election == "2011 Canadian federal election"
replace district_name = "Trois-Rivières" if district_code == 24072 & election == "2011 Canadian federal election"
replace district_name = "Vaudreuil-Soulanges" if district_code == 24073 & election == "2011 Canadian federal election"
replace district_name = "Verchères--Les Patriotes" if district_code == 24074 & election == "2011 Canadian federal election"
replace district_name = "Westmount--Ville-Marie" if district_code == 24075 & election == "2011 Canadian federal election"
replace district_name = "Ajax--Pickering" if district_code == 35001 & election == "2011 Canadian federal election"
replace district_name = "Algoma--Manitoulin--Kapuskasing" if district_code == 35002 & election == "2011 Canadian federal election"
replace district_name = "Ancaster--Dundas--Flamborough--Westdale" if district_code == 35003 & election == "2011 Canadian federal election"
replace district_name = "Barrie" if district_code == 35004 & election == "2011 Canadian federal election"
replace district_name = "Beaches--East York" if district_code == 35005 & election == "2011 Canadian federal election"
replace district_name = "Bramalea--Gore--Malton" if district_code == 35006 & election == "2011 Canadian federal election"
replace district_name = "Brampton--Springdale" if district_code == 35007 & election == "2011 Canadian federal election"
replace district_name = "Brampton West/Brampton-Ouest" if district_code == 35008 & election == "2011 Canadian federal election"
replace district_name = "Brant" if district_code == 35009 & election == "2011 Canadian federal election"
replace district_name = "Burlington" if district_code == 35010 & election == "2011 Canadian federal election"
replace district_name = "Cambridge" if district_code == 35011 & election == "2011 Canadian federal election"
replace district_name = "Carleton--Mississippi Mills" if district_code == 35012 & election == "2011 Canadian federal election"
replace district_name = "Chatham-Kent--Essex" if district_code == 35013 & election == "2011 Canadian federal election"
replace district_name = "Durham" if district_code == 35014 & election == "2011 Canadian federal election"
replace district_name = "Davenport" if district_code == 35015 & election == "2011 Canadian federal election"
replace district_name = "Don Valley East/Don Valley-Est" if district_code == 35016 & election == "2011 Canadian federal election"
replace district_name = "Don Valley West/Don Valley-Ouest" if district_code == 35017 & election == "2011 Canadian federal election"
replace district_name = "Dufferin--Caledon" if district_code == 35018 & election == "2011 Canadian federal election"
replace district_name = "Eglinton--Lawrence" if district_code == 35019 & election == "2011 Canadian federal election"
replace district_name = "Elgin--Middlesex--London" if district_code == 35020 & election == "2011 Canadian federal election"
replace district_name = "Essex" if district_code == 35021 & election == "2011 Canadian federal election"
replace district_name = "Etobicoke Centre/Etobicoke-Centre" if district_code == 35022 & election == "2011 Canadian federal election"
replace district_name = "Etobicoke--Lakeshore" if district_code == 35023 & election == "2011 Canadian federal election"
replace district_name = "Etobicoke North/Etobicoke-Nord" if district_code == 35024 & election == "2011 Canadian federal election"
replace district_name = "Glengarry--Prescott--Russell" if district_code == 35025 & election == "2011 Canadian federal election"
replace district_name = "Bruce--Grey--Owen Sound" if district_code == 35026 & election == "2011 Canadian federal election"
replace district_name = "Guelph" if district_code == 35027 & election == "2011 Canadian federal election"
replace district_name = "Haldimand--Norfolk" if district_code == 35028 & election == "2011 Canadian federal election"
replace district_name = "Haliburton--Kawartha Lakes--Brock" if district_code == 35029 & election == "2011 Canadian federal election"
replace district_name = "Halton" if district_code == 35030 & election == "2011 Canadian federal election"
replace district_name = "Hamilton Centre/Hamilton-Centre" if district_code == 35031 & election == "2011 Canadian federal election"
replace district_name = "Hamilton East--Stoney Creek/Hamilton-Est--Stoney Creek" if district_code == 35032 & election == "2011 Canadian federal election"
replace district_name = "Hamilton Mountain" if district_code == 35033 & election == "2011 Canadian federal election"
replace district_name = "Huron--Bruce" if district_code == 35034 & election == "2011 Canadian federal election"
replace district_name = "Kenora" if district_code == 35035 & election == "2011 Canadian federal election"
replace district_name = "Kingston and the Islands/Kingston et les Îles" if district_code == 35036 & election == "2011 Canadian federal election"
replace district_name = "Kitchener Centre/Kitchener-Centre" if district_code == 35037 & election == "2011 Canadian federal election"
replace district_name = "Kitchener--Conestoga" if district_code == 35038 & election == "2011 Canadian federal election"
replace district_name = "Kitchener--Waterloo" if district_code == 35039 & election == "2011 Canadian federal election"
replace district_name = "Lanark--Frontenac--Lennox and Addington" if district_code == 35040 & election == "2011 Canadian federal election"
replace district_name = "Leeds--Grenville" if district_code == 35041 & election == "2011 Canadian federal election"
replace district_name = "London--Fanshawe" if district_code == 35042 & election == "2011 Canadian federal election"
replace district_name = "London North Centre/London-Centre-Nord" if district_code == 35043 & election == "2011 Canadian federal election"
replace district_name = "London West/London-Ouest" if district_code == 35044 & election == "2011 Canadian federal election"
replace district_name = "Markham--Unionville" if district_code == 35045 & election == "2011 Canadian federal election"
replace district_name = "Lambton--Kent--Middlesex" if district_code == 35046 & election == "2011 Canadian federal election"
replace district_name = "Mississauga--Brampton South/Mississauga--Brampton-Sud" if district_code == 35047 & election == "2011 Canadian federal election"
replace district_name = "Mississauga East--Cooksville/Mississauga-Est--Cooksville" if district_code == 35048 & election == "2011 Canadian federal election"
replace district_name = "Mississauga--Erindale" if district_code == 35049 & election == "2011 Canadian federal election"
replace district_name = "Mississauga South/Mississauga-Sud" if district_code == 35050 & election == "2011 Canadian federal election"
replace district_name = "Mississauga--Streetsville" if district_code == 35051 & election == "2011 Canadian federal election"
replace district_name = "Nepean--Carleton" if district_code == 35052 & election == "2011 Canadian federal election"
replace district_name = "Newmarket--Aurora" if district_code == 35053 & election == "2011 Canadian federal election"
replace district_name = "Niagara Falls" if district_code == 35054 & election == "2011 Canadian federal election"
replace district_name = "Niagara West--Glanbrook/Niagara-Ouest--Glanbrook" if district_code == 35055 & election == "2011 Canadian federal election"
replace district_name = "Nickel Belt" if district_code == 35056 & election == "2011 Canadian federal election"
replace district_name = "Nipissing--Timiskaming" if district_code == 35057 & election == "2011 Canadian federal election"
replace district_name = "Northumberland--Quinte West" if district_code == 35058 & election == "2011 Canadian federal election"
replace district_name = "Oak Ridges--Markham" if district_code == 35059 & election == "2011 Canadian federal election"
replace district_name = "Oakville" if district_code == 35060 & election == "2011 Canadian federal election"
replace district_name = "Oshawa" if district_code == 35061 & election == "2011 Canadian federal election"
replace district_name = "Ottawa Centre/Ottawa-Centre" if district_code == 35062 & election == "2011 Canadian federal election"
replace district_name = "Ottawa--Orléans" if district_code == 35063 & election == "2011 Canadian federal election"
replace district_name = "Ottawa South/Ottawa-Sud" if district_code == 35064 & election == "2011 Canadian federal election"
replace district_name = "Ottawa--Vanier" if district_code == 35065 & election == "2011 Canadian federal election"
replace district_name = "Ottawa West--Nepean/Ottawa-Ouest--Nepean" if district_code == 35066 & election == "2011 Canadian federal election"
replace district_name = "Oxford" if district_code == 35067 & election == "2011 Canadian federal election"
replace district_name = "Parkdale--High Park" if district_code == 35068 & election == "2011 Canadian federal election"
replace district_name = "Parry Sound--Muskoka" if district_code == 35069 & election == "2011 Canadian federal election"
replace district_name = "Perth--Wellington" if district_code == 35070 & election == "2011 Canadian federal election"
replace district_name = "Peterborough" if district_code == 35071 & election == "2011 Canadian federal election"
replace district_name = "Pickering--Scarborough East/Pickering--Scarborough-Est" if district_code == 35072 & election == "2011 Canadian federal election"
replace district_name = "Prince Edward--Hastings" if district_code == 35073 & election == "2011 Canadian federal election"
replace district_name = "Renfrew--Nipissing--Pembroke" if district_code == 35074 & election == "2011 Canadian federal election"
replace district_name = "Richmond Hill" if district_code == 35075 & election == "2011 Canadian federal election"
replace district_name = "St. Catharines" if district_code == 35076 & election == "2011 Canadian federal election"
replace district_name = "St. Paul's" if district_code == 35077 & election == "2011 Canadian federal election"
replace district_name = "Sarnia--Lambton" if district_code == 35078 & election == "2011 Canadian federal election"
replace district_name = "Sault Ste. Marie" if district_code == 35079 & election == "2011 Canadian federal election"
replace district_name = "Scarborough--Agincourt" if district_code == 35080 & election == "2011 Canadian federal election"
replace district_name = "Scarborough Centre/Scarborough-Centre" if district_code == 35081 & election == "2011 Canadian federal election"
replace district_name = "Scarborough--Guildwood" if district_code == 35082 & election == "2011 Canadian federal election"
replace district_name = "Scarborough--Rouge River" if district_code == 35083 & election == "2011 Canadian federal election"
replace district_name = "Scarborough Southwest/Scarborough-Sud-Ouest" if district_code == 35084 & election == "2011 Canadian federal election"
replace district_name = "Simcoe--Grey" if district_code == 35085 & election == "2011 Canadian federal election"
replace district_name = "Simcoe North/Simcoe-Nord" if district_code == 35086 & election == "2011 Canadian federal election"
replace district_name = "Stormont--Dundas--South Glengarry" if district_code == 35087 & election == "2011 Canadian federal election"
replace district_name = "Sudbury" if district_code == 35088 & election == "2011 Canadian federal election"
replace district_name = "Thornhill" if district_code == 35089 & election == "2011 Canadian federal election"
replace district_name = "Thunder Bay--Rainy River" if district_code == 35090 & election == "2011 Canadian federal election"
replace district_name = "Thunder Bay--Superior North/Thunder Bay--Superior-Nord" if district_code == 35091 & election == "2011 Canadian federal election"
replace district_name = "Timmins--James Bay/Timmins--Baie James" if district_code == 35092 & election == "2011 Canadian federal election"
replace district_name = "Toronto Centre/Toronto-Centre" if district_code == 35093 & election == "2011 Canadian federal election"
replace district_name = "Toronto--Danforth" if district_code == 35094 & election == "2011 Canadian federal election"
replace district_name = "Trinity--Spadina" if district_code == 35095 & election == "2011 Canadian federal election"
replace district_name = "Vaughan" if district_code == 35096 & election == "2011 Canadian federal election"
replace district_name = "Welland" if district_code == 35097 & election == "2011 Canadian federal election"
replace district_name = "Wellington--Halton Hills" if district_code == 35098 & election == "2011 Canadian federal election"
replace district_name = "Whitby--Oshawa" if district_code == 35099 & election == "2011 Canadian federal election"
replace district_name = "Willowdale" if district_code == 35100 & election == "2011 Canadian federal election"
replace district_name = "Windsor--Tecumseh" if district_code == 35101 & election == "2011 Canadian federal election"
replace district_name = "Windsor West/Windsor-Ouest" if district_code == 35102 & election == "2011 Canadian federal election"
replace district_name = "York Centre/York-Centre" if district_code == 35103 & election == "2011 Canadian federal election"
replace district_name = "York--Simcoe" if district_code == 35104 & election == "2011 Canadian federal election"
replace district_name = "York South--Weston/York-Sud--Weston" if district_code == 35105 & election == "2011 Canadian federal election"
replace district_name = "York West/York-Ouest" if district_code == 35106 & election == "2011 Canadian federal election"
replace district_name = "Brandon--Souris" if district_code == 46001 & election == "2011 Canadian federal election"
replace district_name = "Charleswood--St. James--Assiniboia" if district_code == 46002 & election == "2011 Canadian federal election"
replace district_name = "Churchill" if district_code == 46003 & election == "2011 Canadian federal election"
replace district_name = "Dauphin--Swan River--Marquette" if district_code == 46004 & election == "2011 Canadian federal election"
replace district_name = "Elmwood--Transcona" if district_code == 46005 & election == "2011 Canadian federal election"
replace district_name = "Kildonan--St. Paul" if district_code == 46006 & election == "2011 Canadian federal election"
replace district_name = "Portage--Lisgar" if district_code == 46007 & election == "2011 Canadian federal election"
replace district_name = "Provencher" if district_code == 46008 & election == "2011 Canadian federal election"
replace district_name = "Saint Boniface/Saint-Boniface" if district_code == 46009 & election == "2011 Canadian federal election"
replace district_name = "Selkirk--Interlake" if district_code == 46010 & election == "2011 Canadian federal election"
replace district_name = "Winnipeg Centre/Winnipeg-Centre" if district_code == 46011 & election == "2011 Canadian federal election"
replace district_name = "Winnipeg North/Winnipeg-Nord" if district_code == 46012 & election == "2011 Canadian federal election"
replace district_name = "Winnipeg South/Winnipeg-Sud" if district_code == 46013 & election == "2011 Canadian federal election"
replace district_name = "Winnipeg South Centre/Winnipeg-Centre-Sud" if district_code == 46014 & election == "2011 Canadian federal election"
replace district_name = "Battlefords--Lloydminster" if district_code == 47001 & election == "2011 Canadian federal election"
replace district_name = "Blackstrap" if district_code == 47002 & election == "2011 Canadian federal election"
replace district_name = "Desnethé--Missinippi--Churchill River/Desnethé--Missinippi--Rivière Churchill" if district_code == 47003 & election == "2011 Canadian federal election"
replace district_name = "Cypress Hills--Grasslands" if district_code == 47004 & election == "2011 Canadian federal election"
replace district_name = "Palliser" if district_code == 47005 & election == "2011 Canadian federal election"
replace district_name = "Prince Albert" if district_code == 47006 & election == "2011 Canadian federal election"
replace district_name = "Regina--Lumsden--Lake Centre" if district_code == 47007 & election == "2011 Canadian federal election"
replace district_name = "Regina--Qu'Appelle" if district_code == 47008 & election == "2011 Canadian federal election"
replace district_name = "Saskatoon--Humboldt" if district_code == 47009 & election == "2011 Canadian federal election"
replace district_name = "Saskatoon--Rosetown--Biggar" if district_code == 47010 & election == "2011 Canadian federal election"
replace district_name = "Saskatoon--Wanuskewin" if district_code == 47011 & election == "2011 Canadian federal election"
replace district_name = "Souris--Moose Mountain" if district_code == 47012 & election == "2011 Canadian federal election"
replace district_name = "Wascana" if district_code == 47013 & election == "2011 Canadian federal election"
replace district_name = "Yorkton--Melville" if district_code == 47014 & election == "2011 Canadian federal election"
replace district_name = "Fort McMurray--Athabasca" if district_code == 48001 & election == "2011 Canadian federal election"
replace district_name = "Calgary East/Calgary-Est" if district_code == 48002 & election == "2011 Canadian federal election"
replace district_name = "Calgary Centre-North/Calgary-Centre-Nord" if district_code == 48003 & election == "2011 Canadian federal election"
replace district_name = "Calgary Northeast/Calgary-Nord-Est" if district_code == 48004 & election == "2011 Canadian federal election"
replace district_name = "Calgary--Nose Hill" if district_code == 48005 & election == "2011 Canadian federal election"
replace district_name = "Calgary Centre/Calgary-Centre" if district_code == 48006 & election == "2011 Canadian federal election"
replace district_name = "Calgary Southeast/Calgary-Sud-Est" if district_code == 48007 & election == "2011 Canadian federal election"
replace district_name = "Calgary Southwest/Calgary-Sud-Ouest" if district_code == 48008 & election == "2011 Canadian federal election"
replace district_name = "Calgary West/Calgary-Ouest" if district_code == 48009 & election == "2011 Canadian federal election"
replace district_name = "Crowfoot" if district_code == 48010 & election == "2011 Canadian federal election"
replace district_name = "Edmonton--Mill Woods--Beaumont" if district_code == 48011 & election == "2011 Canadian federal election"
replace district_name = "Edmonton Centre/Edmonton-Centre" if district_code == 48012 & election == "2011 Canadian federal election"
replace district_name = "Edmonton East/Edmonton-Est" if district_code == 48013 & election == "2011 Canadian federal election"
replace district_name = "Edmonton--Leduc" if district_code == 48014 & election == "2011 Canadian federal election"
replace district_name = "Edmonton--St. Albert" if district_code == 48015 & election == "2011 Canadian federal election"
replace district_name = "Edmonton--Sherwood Park" if district_code == 48016 & election == "2011 Canadian federal election"
replace district_name = "Edmonton--Spruce Grove" if district_code == 48017 & election == "2011 Canadian federal election"
replace district_name = "Edmonton--Strathcona" if district_code == 48018 & election == "2011 Canadian federal election"
replace district_name = "Lethbridge" if district_code == 48019 & election == "2011 Canadian federal election"
replace district_name = "Macleod" if district_code == 48020 & election == "2011 Canadian federal election"
replace district_name = "Medicine Hat" if district_code == 48021 & election == "2011 Canadian federal election"
replace district_name = "Peace River" if district_code == 48022 & election == "2011 Canadian federal election"
replace district_name = "Red Deer" if district_code == 48023 & election == "2011 Canadian federal election"
replace district_name = "Vegreville--Wainwright" if district_code == 48024 & election == "2011 Canadian federal election"
replace district_name = "Westlock--St. Paul" if district_code == 48025 & election == "2011 Canadian federal election"
replace district_name = "Wetaskiwin" if district_code == 48026 & election == "2011 Canadian federal election"
replace district_name = "Wild Rose" if district_code == 48027 & election == "2011 Canadian federal election"
replace district_name = "Yellowhead" if district_code == 48028 & election == "2011 Canadian federal election"
replace district_name = "Abbotsford" if district_code == 59001 & election == "2011 Canadian federal election"
replace district_name = "Burnaby--Douglas" if district_code == 59002 & election == "2011 Canadian federal election"
replace district_name = "Burnaby--New Westminster" if district_code == 59003 & election == "2011 Canadian federal election"
replace district_name = "Cariboo--Prince George" if district_code == 59004 & election == "2011 Canadian federal election"
replace district_name = "Chilliwack--Fraser Canyon" if district_code == 59005 & election == "2011 Canadian federal election"
replace district_name = "Delta--Richmond East/Delta--Richmond-Est" if district_code == 59006 & election == "2011 Canadian federal election"
replace district_name = "Pitt Meadows--Maple Ridge--Mission" if district_code == 59007 & election == "2011 Canadian federal election"
replace district_name = "Esquimalt--Juan de Fuca" if district_code == 59008 & election == "2011 Canadian federal election"
replace district_name = "Fleetwood--Port Kells" if district_code == 59009 & election == "2011 Canadian federal election"
replace district_name = "Kamloops--Thompson--Cariboo" if district_code == 59010 & election == "2011 Canadian federal election"
replace district_name = "Kelowna--Lake Country" if district_code == 59011 & election == "2011 Canadian federal election"
replace district_name = "Kootenay--Columbia" if district_code == 59012 & election == "2011 Canadian federal election"
replace district_name = "Langley" if district_code == 59013 & election == "2011 Canadian federal election"
replace district_name = "Nanaimo--Alberni" if district_code == 59014 & election == "2011 Canadian federal election"
replace district_name = "Nanaimo--Cowichan" if district_code == 59015 & election == "2011 Canadian federal election"
replace district_name = "Newton--North Delta/Newton--Delta-Nord" if district_code == 59016 & election == "2011 Canadian federal election"
replace district_name = "New Westminster--Coquitlam" if district_code == 59017 & election == "2011 Canadian federal election"
replace district_name = "Okanagan--Shuswap" if district_code == 59018 & election == "2011 Canadian federal election"
replace district_name = "North Vancouver" if district_code == 59019 & election == "2011 Canadian federal election"
replace district_name = "Okanagan--Coquihalla" if district_code == 59020 & election == "2011 Canadian federal election"
replace district_name = "Port Moody--Westwood--Port Coquitlam" if district_code == 59021 & election == "2011 Canadian federal election"
replace district_name = "Prince George--Peace River" if district_code == 59022 & election == "2011 Canadian federal election"
replace district_name = "Richmond" if district_code == 59023 & election == "2011 Canadian federal election"
replace district_name = "Saanich--Gulf Islands" if district_code == 59024 & election == "2011 Canadian federal election"
replace district_name = "Skeena--Bulkley Valley" if district_code == 59025 & election == "2011 Canadian federal election"
replace district_name = "British Columbia Southern Interior/Colombie-Britannique-Southern Interior" if district_code == 59026 & election == "2011 Canadian federal election"
replace district_name = "South Surrey--White Rock--Cloverdale/Surrey-Sud--White Rock--Cloverdale" if district_code == 59027 & election == "2011 Canadian federal election"
replace district_name = "Surrey North/Surrey-Nord" if district_code == 59028 & election == "2011 Canadian federal election"
replace district_name = "Vancouver Centre/Vancouver-Centre" if district_code == 59029 & election == "2011 Canadian federal election"
replace district_name = "Vancouver East/Vancouver-Est" if district_code == 59030 & election == "2011 Canadian federal election"
replace district_name = "Vancouver Island North/Île de Vancouver-Nord" if district_code == 59031 & election == "2011 Canadian federal election"
replace district_name = "Vancouver Kingsway" if district_code == 59032 & election == "2011 Canadian federal election"
replace district_name = "Vancouver Quadra" if district_code == 59033 & election == "2011 Canadian federal election"
replace district_name = "Vancouver South/Vancouver-Sud" if district_code == 59034 & election == "2011 Canadian federal election"
replace district_name = "Victoria" if district_code == 59035 & election == "2011 Canadian federal election"
replace district_name = "West Vancouver--Sunshine Coast--Sea to Sky Country" if district_code == 59036 & election == "2011 Canadian federal election"
replace district_name = "Yukon" if district_code == 60001 & election == "2011 Canadian federal election"
replace district_name = "Western Arctic" if district_code == 61001 & election == "2011 Canadian federal election"
replace district_name = "Nunavut" if district_code == 62001 & election == "2011 Canadian federal election"
replace district_name = "Avalon" if district_code == 10001 & election == "2015 Canadian federal election"
replace district_name = "Bonavista--Burin--Trinity" if district_code == 10002 & election == "2015 Canadian federal election"
replace district_name = "Coast of Bays--Central--Notre Dame" if district_code == 10003 & election == "2015 Canadian federal election"
replace district_name = "Labrador" if district_code == 10004 & election == "2015 Canadian federal election"
replace district_name = "Long Range Mountains" if district_code == 10005 & election == "2015 Canadian federal election"
replace district_name = "St. John's East/St. John's-Est" if district_code == 10006 & election == "2015 Canadian federal election"
replace district_name = "St. John's South--Mount Pearl/St. John's-Sud--Mount Pearl" if district_code == 10007 & election == "2015 Canadian federal election"
replace district_name = "Cardigan" if district_code == 11001 & election == "2015 Canadian federal election"
replace district_name = "Charlottetown" if district_code == 11002 & election == "2015 Canadian federal election"
replace district_name = "Egmont" if district_code == 11003 & election == "2015 Canadian federal election"
replace district_name = "Malpeque" if district_code == 11004 & election == "2015 Canadian federal election"
replace district_name = "Cape Breton--Canso" if district_code == 12001 & election == "2015 Canadian federal election"
replace district_name = "Central Nova/Nova-Centre" if district_code == 12002 & election == "2015 Canadian federal election"
replace district_name = "Cumberland--Colchester" if district_code == 12003 & election == "2015 Canadian federal election"
replace district_name = "Dartmouth--Cole Harbour" if district_code == 12004 & election == "2015 Canadian federal election"
replace district_name = "Halifax" if district_code == 12005 & election == "2015 Canadian federal election"
replace district_name = "Halifax West/Halifax-Ouest" if district_code == 12006 & election == "2015 Canadian federal election"
replace district_name = "Kings--Hants" if district_code == 12007 & election == "2015 Canadian federal election"
replace district_name = "Sackville--Preston--Chezzetcook" if district_code == 12008 & election == "2015 Canadian federal election"
replace district_name = "South Shore--St. Margarets" if district_code == 12009 & election == "2015 Canadian federal election"
replace district_name = "Sydney--Victoria" if district_code == 12010 & election == "2015 Canadian federal election"
replace district_name = "West Nova/Nova-Ouest" if district_code == 12011 & election == "2015 Canadian federal election"
replace district_name = "Acadie--Bathurst" if district_code == 13001 & election == "2015 Canadian federal election"
replace district_name = "BeausÃ©jour" if district_code == 13002 & election == "2015 Canadian federal election"
replace district_name = "Fredericton" if district_code == 13003 & election == "2015 Canadian federal election"
replace district_name = "Fundy Royal" if district_code == 13004 & election == "2015 Canadian federal election"
replace district_name = "Madawaska--Restigouche" if district_code == 13005 & election == "2015 Canadian federal election"
replace district_name = "Miramichi--Grand Lake" if district_code == 13006 & election == "2015 Canadian federal election"
replace district_name = "Moncton--Riverview--Dieppe" if district_code == 13007 & election == "2015 Canadian federal election"
replace district_name = "New Brunswick Southwest/Nouveau-Brunswick-Sud-Ouest" if district_code == 13008 & election == "2015 Canadian federal election"
replace district_name = "Saint John--Rothesay" if district_code == 13009 & election == "2015 Canadian federal election"
replace district_name = "Tobique--Mactaquac" if district_code == 13010 & election == "2015 Canadian federal election"
replace district_name = "Abitibi--Baie-James--Nunavik--Eeyou" if district_code == 24001 & election == "2015 Canadian federal election"
replace district_name = "Abitibi--TÃ©miscamingue" if district_code == 24002 & election == "2015 Canadian federal election"
replace district_name = "Ahuntsic-Cartierville" if district_code == 24003 & election == "2015 Canadian federal election"
replace district_name = "Alfred-Pellan" if district_code == 24004 & election == "2015 Canadian federal election"
replace district_name = "Argenteuil--La Petite-Nation" if district_code == 24005 & election == "2015 Canadian federal election"
replace district_name = "Avignon--La Mitis--Matane--MatapÃ©dia" if district_code == 24006 & election == "2015 Canadian federal election"
replace district_name = "Beauce" if district_code == 24007 & election == "2015 Canadian federal election"
replace district_name = "Beauport--Limoilou" if district_code == 24008 & election == "2015 Canadian federal election"
replace district_name = "BÃ©cancour--Nicolet--Saurel" if district_code == 24009 & election == "2015 Canadian federal election"
replace district_name = "Bellechasse--Les Etchemins--LÃ©vis" if district_code == 24010 & election == "2015 Canadian federal election"
replace district_name = "Beloeil--Chambly" if district_code == 24011 & election == "2015 Canadian federal election"
replace district_name = "Berthier--MaskinongÃ©" if district_code == 24012 & election == "2015 Canadian federal election"
replace district_name = "ThÃ©rÃ¨se-De Blainville" if district_code == 24013 & election == "2015 Canadian federal election"
replace district_name = "Pierre-Boucher--Les Patriotes--VerchÃ¨res" if district_code == 24014 & election == "2015 Canadian federal election"
replace district_name = "Bourassa" if district_code == 24015 & election == "2015 Canadian federal election"
replace district_name = "Brome--Missisquoi" if district_code == 24016 & election == "2015 Canadian federal election"
replace district_name = "Brossard--Saint-Lambert" if district_code == 24017 & election == "2015 Canadian federal election"
replace district_name = "Rimouski-Neigette--TÃ©miscouata--Les Basques" if district_code == 24018 & election == "2015 Canadian federal election"
replace district_name = "Charlesbourg--Haute-Saint-Charles" if district_code == 24019 & election == "2015 Canadian federal election"
replace district_name = "Beauport--CÃ´te-de-BeauprÃ©--Ãle d'OrlÃ©ans--Charlevoix" if district_code == 24020 & election == "2015 Canadian federal election"
replace district_name = "ChÃ¢teauguay--Lacolle" if district_code == 24021 & election == "2015 Canadian federal election"
replace district_name = "Chicoutimi--Le Fjord" if district_code == 24022 & election == "2015 Canadian federal election"
replace district_name = "Compton--Stanstead" if district_code == 24023 & election == "2015 Canadian federal election"
replace district_name = "Dorval--Lachine--LaSalle" if district_code == 24024 & election == "2015 Canadian federal election"
replace district_name = "Drummond" if district_code == 24025 & election == "2015 Canadian federal election"
replace district_name = "GaspÃ©sie--Les Ãles-de-la-Madeleine" if district_code == 24026 & election == "2015 Canadian federal election"
replace district_name = "Gatineau" if district_code == 24027 & election == "2015 Canadian federal election"
replace district_name = "Hochelaga" if district_code == 24028 & election == "2015 Canadian federal election"
replace district_name = "HonorÃ©-Mercier" if district_code == 24029 & election == "2015 Canadian federal election"
replace district_name = "Hull--Aylmer" if district_code == 24030 & election == "2015 Canadian federal election"
replace district_name = "Joliette" if district_code == 24031 & election == "2015 Canadian federal election"
replace district_name = "JonquiÃ¨re" if district_code == 24032 & election == "2015 Canadian federal election"
replace district_name = "La Pointe-de-l'Ãle" if district_code == 24033 & election == "2015 Canadian federal election"
replace district_name = "La Prairie" if district_code == 24034 & election == "2015 Canadian federal election"
replace district_name = "Lac-Saint-Jean" if district_code == 24035 & election == "2015 Canadian federal election"
replace district_name = "Lac-Saint-Louis" if district_code == 24036 & election == "2015 Canadian federal election"
replace district_name = "LaSalle--Ãmard--Verdun" if district_code == 24037 & election == "2015 Canadian federal election"
replace district_name = "Laurentides--Labelle" if district_code == 24038 & election == "2015 Canadian federal election"
replace district_name = "Laurier--Sainte-Marie" if district_code == 24039 & election == "2015 Canadian federal election"
replace district_name = "Laval--Les Ãles" if district_code == 24040 & election == "2015 Canadian federal election"
replace district_name = "Longueuil--Charles-LeMoyne" if district_code == 24041 & election == "2015 Canadian federal election"
replace district_name = "LÃ©vis--LotbiniÃ¨re" if district_code == 24042 & election == "2015 Canadian federal election"
replace district_name = "Longueuil--Saint-Hubert" if district_code == 24043 & election == "2015 Canadian federal election"
replace district_name = "Louis-HÃ©bert" if district_code == 24044 & election == "2015 Canadian federal election"
replace district_name = "Louis-Saint-Laurent" if district_code == 24045 & election == "2015 Canadian federal election"
replace district_name = "Manicouagan" if district_code == 24046 & election == "2015 Canadian federal election"
replace district_name = "MÃ©gantic--L'Ãrable" if district_code == 24047 & election == "2015 Canadian federal election"
replace district_name = "Mirabel" if district_code == 24048 & election == "2015 Canadian federal election"
replace district_name = "Montarville" if district_code == 24049 & election == "2015 Canadian federal election"
replace district_name = "Montcalm" if district_code == 24050 & election == "2015 Canadian federal election"
replace district_name = "Montmagny--L'Islet--Kamouraska--RiviÃ¨re-du-Loup" if district_code == 24051 & election == "2015 Canadian federal election"
replace district_name = "Mount Royal/Mont-Royal" if district_code == 24052 & election == "2015 Canadian federal election"
replace district_name = "Notre-Dame-de-GrÃ¢ce--Westmount" if district_code == 24053 & election == "2015 Canadian federal election"
replace district_name = "Outremont" if district_code == 24054 & election == "2015 Canadian federal election"
replace district_name = "Papineau" if district_code == 24055 & election == "2015 Canadian federal election"
replace district_name = "Pierrefonds--Dollard" if district_code == 24056 & election == "2015 Canadian federal election"
replace district_name = "Pontiac" if district_code == 24057 & election == "2015 Canadian federal election"
replace district_name = "Portneuf--Jacques-Cartier" if district_code == 24058 & election == "2015 Canadian federal election"
replace district_name = "QuÃ©bec" if district_code == 24059 & election == "2015 Canadian federal election"
replace district_name = "Repentigny" if district_code == 24060 & election == "2015 Canadian federal election"
replace district_name = "Richmond--Arthabaska" if district_code == 24061 & election == "2015 Canadian federal election"
replace district_name = "RiviÃ¨re-des-Mille-Ãles" if district_code == 24062 & election == "2015 Canadian federal election"
replace district_name = "RiviÃ¨re-du-Nord" if district_code == 24063 & election == "2015 Canadian federal election"
replace district_name = "Rosemont--La Petite-Patrie" if district_code == 24064 & election == "2015 Canadian federal election"
replace district_name = "Marc-AurÃ¨le-Fortin" if district_code == 24065 & election == "2015 Canadian federal election"
replace district_name = "Saint-Hyacinthe--Bagot" if district_code == 24066 & election == "2015 Canadian federal election"
replace district_name = "Saint-Jean" if district_code == 24067 & election == "2015 Canadian federal election"
replace district_name = "Saint-Laurent" if district_code == 24068 & election == "2015 Canadian federal election"
replace district_name = "Saint-LÃ©onard--Saint-Michel" if district_code == 24069 & election == "2015 Canadian federal election"
replace district_name = "Saint-Maurice--Champlain" if district_code == 24070 & election == "2015 Canadian federal election"
replace district_name = "Salaberry--SuroÃ®t" if district_code == 24071 & election == "2015 Canadian federal election"
replace district_name = "Shefford" if district_code == 24072 & election == "2015 Canadian federal election"
replace district_name = "Sherbrooke" if district_code == 24073 & election == "2015 Canadian federal election"
replace district_name = "Vaudreuil--Soulanges" if district_code == 24074 & election == "2015 Canadian federal election"
replace district_name = "Terrebonne" if district_code == 24075 & election == "2015 Canadian federal election"
replace district_name = "Trois-RiviÃ¨res" if district_code == 24076 & election == "2015 Canadian federal election"
replace district_name = "Ville-Marie--Le Sud-Ouest--Ãle-des-Soeurs" if district_code == 24077 & election == "2015 Canadian federal election"
replace district_name = "Vimy" if district_code == 24078 & election == "2015 Canadian federal election"
replace district_name = "Ajax" if district_code == 35001 & election == "2015 Canadian federal election"
replace district_name = "Algoma--Manitoulin--Kapuskasing" if district_code == 35002 & election == "2015 Canadian federal election"
replace district_name = "Aurora--Oak Ridges--Richmond Hill" if district_code == 35003 & election == "2015 Canadian federal election"
replace district_name = "Barrie--Innisfil" if district_code == 35004 & election == "2015 Canadian federal election"
replace district_name = "Barrie--Springwater--Oro-Medonte" if district_code == 35005 & election == "2015 Canadian federal election"
replace district_name = "Bay of Quinte/Baie de Quinte" if district_code == 35006 & election == "2015 Canadian federal election"
replace district_name = "Beaches--East York" if district_code == 35007 & election == "2015 Canadian federal election"
replace district_name = "Brampton Centre/Brampton-Centre" if district_code == 35008 & election == "2015 Canadian federal election"
replace district_name = "Brampton East/Brampton-Est" if district_code == 35009 & election == "2015 Canadian federal election"
replace district_name = "Brampton North/Brampton-Nord" if district_code == 35010 & election == "2015 Canadian federal election"
replace district_name = "Brampton South/Brampton-Sud" if district_code == 35011 & election == "2015 Canadian federal election"
replace district_name = "Brampton West/Brampton-Ouest" if district_code == 35012 & election == "2015 Canadian federal election"
replace district_name = "Brantford--Brant" if district_code == 35013 & election == "2015 Canadian federal election"
replace district_name = "Bruce--Grey--Owen Sound" if district_code == 35014 & election == "2015 Canadian federal election"
replace district_name = "Burlington" if district_code == 35015 & election == "2015 Canadian federal election"
replace district_name = "Cambridge" if district_code == 35016 & election == "2015 Canadian federal election"
replace district_name = "Chatham-Kent--Leamington" if district_code == 35017 & election == "2015 Canadian federal election"
replace district_name = "Davenport" if district_code == 35018 & election == "2015 Canadian federal election"
replace district_name = "Don Valley East/Don Valley-Est" if district_code == 35019 & election == "2015 Canadian federal election"
replace district_name = "Don Valley North/Don Valley-Nord" if district_code == 35020 & election == "2015 Canadian federal election"
replace district_name = "Don Valley West/Don Valley-Ouest" if district_code == 35021 & election == "2015 Canadian federal election"
replace district_name = "Dufferin--Caledon" if district_code == 35022 & election == "2015 Canadian federal election"
replace district_name = "Durham" if district_code == 35023 & election == "2015 Canadian federal election"
replace district_name = "Eglinton--Lawrence" if district_code == 35024 & election == "2015 Canadian federal election"
replace district_name = "Elgin--Middlesex--London" if district_code == 35025 & election == "2015 Canadian federal election"
replace district_name = "Essex" if district_code == 35026 & election == "2015 Canadian federal election"
replace district_name = "Etobicoke Centre/Etobicoke-Centre" if district_code == 35027 & election == "2015 Canadian federal election"
replace district_name = "Etobicoke--Lakeshore" if district_code == 35028 & election == "2015 Canadian federal election"
replace district_name = "Etobicoke North/Etobicoke-Nord" if district_code == 35029 & election == "2015 Canadian federal election"
replace district_name = "Flamborough--Glanbrook" if district_code == 35030 & election == "2015 Canadian federal election"
replace district_name = "Glengarry--Prescott--Russell" if district_code == 35031 & election == "2015 Canadian federal election"
replace district_name = "Guelph" if district_code == 35032 & election == "2015 Canadian federal election"
replace district_name = "Haldimand--Norfolk" if district_code == 35033 & election == "2015 Canadian federal election"
replace district_name = "Haliburton--Kawartha Lakes--Brock" if district_code == 35034 & election == "2015 Canadian federal election"
replace district_name = "Hamilton Centre/Hamilton-Centre" if district_code == 35035 & election == "2015 Canadian federal election"
replace district_name = "Hamilton East--Stoney Creek/Hamilton-Est--Stoney Creek" if district_code == 35036 & election == "2015 Canadian federal election"
replace district_name = "Hamilton Mountain" if district_code == 35037 & election == "2015 Canadian federal election"
replace district_name = "Hamilton West--Ancaster--Dundas/Hamilton-Ouest--Ancaster--Dundas" if district_code == 35038 & election == "2015 Canadian federal election"
replace district_name = "Hastings--Lennox and Addington" if district_code == 35039 & election == "2015 Canadian federal election"
replace district_name = "Huron--Bruce" if district_code == 35040 & election == "2015 Canadian federal election"
replace district_name = "Kanata--Carleton" if district_code == 35041 & election == "2015 Canadian federal election"
replace district_name = "Kenora" if district_code == 35042 & election == "2015 Canadian federal election"
replace district_name = "King--Vaughan" if district_code == 35043 & election == "2015 Canadian federal election"
replace district_name = "Kingston and the Islands/Kingston et les Ãles" if district_code == 35044 & election == "2015 Canadian federal election"
replace district_name = "Kitchener Centre/Kitchener-Centre" if district_code == 35045 & election == "2015 Canadian federal election"
replace district_name = "Kitchener--Conestoga" if district_code == 35046 & election == "2015 Canadian federal election"
replace district_name = "Kitchener South--Hespeler/Kitchener-Sud--Hespeler" if district_code == 35047 & election == "2015 Canadian federal election"
replace district_name = "Lambton--Kent--Middlesex" if district_code == 35048 & election == "2015 Canadian federal election"
replace district_name = "Lanark--Frontenac--Kingston" if district_code == 35049 & election == "2015 Canadian federal election"
replace district_name = "Leeds--Grenville--Thousand Islands and Rideau Lakes/Leeds--Grenville--Thousand Islands et Rideau Lakes" if district_code == 35050 & election == "2015 Canadian federal election"
replace district_name = "London--Fanshawe" if district_code == 35051 & election == "2015 Canadian federal election"
replace district_name = "London North Centre/London-Centre-Nord" if district_code == 35052 & election == "2015 Canadian federal election"
replace district_name = "London West/London-Ouest" if district_code == 35053 & election == "2015 Canadian federal election"
replace district_name = "Markham--Stouffville" if district_code == 35054 & election == "2015 Canadian federal election"
replace district_name = "Markham--Thornhill" if district_code == 35055 & election == "2015 Canadian federal election"
replace district_name = "Markham--Unionville" if district_code == 35056 & election == "2015 Canadian federal election"
replace district_name = "Milton" if district_code == 35057 & election == "2015 Canadian federal election"
replace district_name = "Mississauga Centre/Mississauga-Centre" if district_code == 35058 & election == "2015 Canadian federal election"
replace district_name = "Mississauga East--Cooksville/Mississauga-Est--Cooksville" if district_code == 35059 & election == "2015 Canadian federal election"
replace district_name = "Mississauga--Erin Mills" if district_code == 35060 & election == "2015 Canadian federal election"
replace district_name = "Mississauga--Lakeshore" if district_code == 35061 & election == "2015 Canadian federal election"
replace district_name = "Mississauga--Malton" if district_code == 35062 & election == "2015 Canadian federal election"
replace district_name = "Mississauga--Streetsville" if district_code == 35063 & election == "2015 Canadian federal election"
replace district_name = "Nepean" if district_code == 35064 & election == "2015 Canadian federal election"
replace district_name = "Newmarket--Aurora" if district_code == 35065 & election == "2015 Canadian federal election"
replace district_name = "Niagara Centre/Niagara-Centre" if district_code == 35066 & election == "2015 Canadian federal election"
replace district_name = "Niagara Falls" if district_code == 35067 & election == "2015 Canadian federal election"
replace district_name = "Niagara West/Niagara-Ouest" if district_code == 35068 & election == "2015 Canadian federal election"
replace district_name = "Nickel Belt" if district_code == 35069 & election == "2015 Canadian federal election"
replace district_name = "Nipissing--Timiskaming" if district_code == 35070 & election == "2015 Canadian federal election"
replace district_name = "Northumberland--Peterborough South/Northumberland--Peterborough-Sud" if district_code == 35071 & election == "2015 Canadian federal election"
replace district_name = "Oakville" if district_code == 35072 & election == "2015 Canadian federal election"
replace district_name = "Oakville North--Burlington/Oakville-Nord--Burlington" if district_code == 35073 & election == "2015 Canadian federal election"
replace district_name = "Oshawa" if district_code == 35074 & election == "2015 Canadian federal election"
replace district_name = "Ottawa Centre/Ottawa-Centre" if district_code == 35075 & election == "2015 Canadian federal election"
replace district_name = "OrlÃ©ans" if district_code == 35076 & election == "2015 Canadian federal election"
replace district_name = "Ottawa South/Ottawa-Sud" if district_code == 35077 & election == "2015 Canadian federal election"
replace district_name = "Ottawa--Vanier" if district_code == 35078 & election == "2015 Canadian federal election"
replace district_name = "Ottawa West--Nepean/Ottawa-Ouest--Nepean" if district_code == 35079 & election == "2015 Canadian federal election"
replace district_name = "Oxford" if district_code == 35080 & election == "2015 Canadian federal election"
replace district_name = "Parkdale--High Park" if district_code == 35081 & election == "2015 Canadian federal election"
replace district_name = "Parry Sound--Muskoka" if district_code == 35082 & election == "2015 Canadian federal election"
replace district_name = "Perth--Wellington" if district_code == 35083 & election == "2015 Canadian federal election"
replace district_name = "Peterborough--Kawartha" if district_code == 35084 & election == "2015 Canadian federal election"
replace district_name = "Pickering--Uxbridge" if district_code == 35085 & election == "2015 Canadian federal election"
replace district_name = "Renfrew--Nipissing--Pembroke" if district_code == 35086 & election == "2015 Canadian federal election"
replace district_name = "Richmond Hill" if district_code == 35087 & election == "2015 Canadian federal election"
replace district_name = "Carleton" if district_code == 35088 & election == "2015 Canadian federal election"
replace district_name = "St. Catharines" if district_code == 35089 & election == "2015 Canadian federal election"
replace district_name = "Toronto--St. Paul's" if district_code == 35090 & election == "2015 Canadian federal election"
replace district_name = "Sarnia--Lambton" if district_code == 35091 & election == "2015 Canadian federal election"
replace district_name = "Sault Ste. Marie" if district_code == 35092 & election == "2015 Canadian federal election"
replace district_name = "Scarborough--Agincourt" if district_code == 35093 & election == "2015 Canadian federal election"
replace district_name = "Scarborough Centre/Scarborough-Centre" if district_code == 35094 & election == "2015 Canadian federal election"
replace district_name = "Scarborough--Guildwood" if district_code == 35095 & election == "2015 Canadian federal election"
replace district_name = "Scarborough North/Scarborough-Nord" if district_code == 35096 & election == "2015 Canadian federal election"
replace district_name = "Scarborough--Rouge Park" if district_code == 35097 & election == "2015 Canadian federal election"
replace district_name = "Scarborough Southwest/Scarborough-Sud-Ouest" if district_code == 35098 & election == "2015 Canadian federal election"
replace district_name = "Simcoe--Grey" if district_code == 35099 & election == "2015 Canadian federal election"
replace district_name = "Simcoe North/Simcoe-Nord" if district_code == 35100 & election == "2015 Canadian federal election"
replace district_name = "Spadina--Fort York" if district_code == 35101 & election == "2015 Canadian federal election"
replace district_name = "Stormont--Dundas--South Glengarry" if district_code == 35102 & election == "2015 Canadian federal election"
replace district_name = "Sudbury" if district_code == 35103 & election == "2015 Canadian federal election"
replace district_name = "Thornhill" if district_code == 35104 & election == "2015 Canadian federal election"
replace district_name = "Thunder Bay--Rainy River" if district_code == 35105 & election == "2015 Canadian federal election"
replace district_name = "Thunder Bay--Superior North/Thunder Bay--SupÃ©rieur-Nord" if district_code == 35106 & election == "2015 Canadian federal election"
replace district_name = "Timmins--James Bay/Timmins--Baie James" if district_code == 35107 & election == "2015 Canadian federal election"
replace district_name = "Toronto Centre/Toronto-Centre" if district_code == 35108 & election == "2015 Canadian federal election"
replace district_name = "Toronto--Danforth" if district_code == 35109 & election == "2015 Canadian federal election"
replace district_name = "University--Rosedale" if district_code == 35110 & election == "2015 Canadian federal election"
replace district_name = "Vaughan--Woodbridge" if district_code == 35111 & election == "2015 Canadian federal election"
replace district_name = "Waterloo" if district_code == 35112 & election == "2015 Canadian federal election"
replace district_name = "Wellington--Halton Hills" if district_code == 35113 & election == "2015 Canadian federal election"
replace district_name = "Whitby" if district_code == 35114 & election == "2015 Canadian federal election"
replace district_name = "Willowdale" if district_code == 35115 & election == "2015 Canadian federal election"
replace district_name = "Windsor--Tecumseh" if district_code == 35116 & election == "2015 Canadian federal election"
replace district_name = "Windsor West/Windsor-Ouest" if district_code == 35117 & election == "2015 Canadian federal election"
replace district_name = "York Centre/York-Centre" if district_code == 35118 & election == "2015 Canadian federal election"
replace district_name = "York--Simcoe" if district_code == 35119 & election == "2015 Canadian federal election"
replace district_name = "York South--Weston/York-Sud--Weston" if district_code == 35120 & election == "2015 Canadian federal election"
replace district_name = "Humber River--Black Creek" if district_code == 35121 & election == "2015 Canadian federal election"
replace district_name = "Brandon--Souris" if district_code == 46001 & election == "2015 Canadian federal election"
replace district_name = "Charleswood--St. James--Assiniboia--Headingley" if district_code == 46002 & election == "2015 Canadian federal election"
replace district_name = "Churchill--Keewatinook Aski" if district_code == 46003 & election == "2015 Canadian federal election"
replace district_name = "Dauphin--Swan River--Neepawa" if district_code == 46004 & election == "2015 Canadian federal election"
replace district_name = "Elmwood--Transcona" if district_code == 46005 & election == "2015 Canadian federal election"
replace district_name = "Kildonan--St. Paul" if district_code == 46006 & election == "2015 Canadian federal election"
replace district_name = "Portage--Lisgar" if district_code == 46007 & election == "2015 Canadian federal election"
replace district_name = "Provencher" if district_code == 46008 & election == "2015 Canadian federal election"
replace district_name = "Saint Boniface--Saint Vital/Saint-Boniface--Saint-Vital" if district_code == 46009 & election == "2015 Canadian federal election"
replace district_name = "Selkirk--Interlake--Eastman" if district_code == 46010 & election == "2015 Canadian federal election"
replace district_name = "Winnipeg Centre/Winnipeg-Centre" if district_code == 46011 & election == "2015 Canadian federal election"
replace district_name = "Winnipeg North/Winnipeg-Nord" if district_code == 46012 & election == "2015 Canadian federal election"
replace district_name = "Winnipeg South/Winnipeg-Sud" if district_code == 46013 & election == "2015 Canadian federal election"
replace district_name = "Winnipeg South Centre/Winnipeg-Centre-Sud" if district_code == 46014 & election == "2015 Canadian federal election"
replace district_name = "Battlefords--Lloydminster" if district_code == 47001 & election == "2015 Canadian federal election"
replace district_name = "Cypress Hills--Grasslands" if district_code == 47002 & election == "2015 Canadian federal election"
replace district_name = "DesnethÃ©--Missinippi--Churchill River/DesnethÃ©--Missinippi--RiviÃ¨re Churchill" if district_code == 47003 & election == "2015 Canadian federal election"
replace district_name = "Carlton Trail--Eagle Creek/Sentier Carlton--Eagle Creek" if district_code == 47004 & election == "2015 Canadian federal election"
replace district_name = "Moose Jaw--Lake Centre--Lanigan" if district_code == 47005 & election == "2015 Canadian federal election"
replace district_name = "Prince Albert" if district_code == 47006 & election == "2015 Canadian federal election"
replace district_name = "Regina--Lewvan" if district_code == 47007 & election == "2015 Canadian federal election"
replace district_name = "Regina--Qu'Appelle" if district_code == 47008 & election == "2015 Canadian federal election"
replace district_name = "Regina--Wascana" if district_code == 47009 & election == "2015 Canadian federal election"
replace district_name = "Saskatoon--Grasswood" if district_code == 47010 & election == "2015 Canadian federal election"
replace district_name = "Saskatoon--University" if district_code == 47011 & election == "2015 Canadian federal election"
replace district_name = "Saskatoon West/Saskatoon-Ouest" if district_code == 47012 & election == "2015 Canadian federal election"
replace district_name = "Souris--Moose Mountain" if district_code == 47013 & election == "2015 Canadian federal election"
replace district_name = "Yorkton--Melville" if district_code == 47014 & election == "2015 Canadian federal election"
replace district_name = "Banff--Airdrie" if district_code == 48001 & election == "2015 Canadian federal election"
replace district_name = "Battle River--Crowfoot" if district_code == 48002 & election == "2015 Canadian federal election"
replace district_name = "Bow River" if district_code == 48003 & election == "2015 Canadian federal election"
replace district_name = "Calgary Centre/Calgary-Centre" if district_code == 48004 & election == "2015 Canadian federal election"
replace district_name = "Calgary Confederation" if district_code == 48005 & election == "2015 Canadian federal election"
replace district_name = "Calgary Forest Lawn" if district_code == 48006 & election == "2015 Canadian federal election"
replace district_name = "Calgary Heritage" if district_code == 48007 & election == "2015 Canadian federal election"
replace district_name = "Calgary Midnapore" if district_code == 48008 & election == "2015 Canadian federal election"
replace district_name = "Calgary Nose Hill" if district_code == 48009 & election == "2015 Canadian federal election"
replace district_name = "Calgary Rocky Ridge" if district_code == 48010 & election == "2015 Canadian federal election"
replace district_name = "Calgary Shepard" if district_code == 48011 & election == "2015 Canadian federal election"
replace district_name = "Calgary Signal Hill" if district_code == 48012 & election == "2015 Canadian federal election"
replace district_name = "Calgary Skyview" if district_code == 48013 & election == "2015 Canadian federal election"
replace district_name = "Edmonton Centre/Edmonton-Centre" if district_code == 48014 & election == "2015 Canadian federal election"
replace district_name = "Edmonton Griesbach" if district_code == 48015 & election == "2015 Canadian federal election"
replace district_name = "Edmonton Manning" if district_code == 48016 & election == "2015 Canadian federal election"
replace district_name = "Edmonton Mill Woods" if district_code == 48017 & election == "2015 Canadian federal election"
replace district_name = "Edmonton Riverbend" if district_code == 48018 & election == "2015 Canadian federal election"
replace district_name = "Edmonton Strathcona" if district_code == 48019 & election == "2015 Canadian federal election"
replace district_name = "Edmonton West/Edmonton-Ouest" if district_code == 48020 & election == "2015 Canadian federal election"
replace district_name = "Edmonton--Wetaskiwin" if district_code == 48021 & election == "2015 Canadian federal election"
replace district_name = "Foothills" if district_code == 48022 & election == "2015 Canadian federal election"
replace district_name = "Fort McMurray--Cold Lake" if district_code == 48023 & election == "2015 Canadian federal election"
replace district_name = "Grande Prairie--Mackenzie" if district_code == 48024 & election == "2015 Canadian federal election"
replace district_name = "Lakeland" if district_code == 48025 & election == "2015 Canadian federal election"
replace district_name = "Lethbridge" if district_code == 48026 & election == "2015 Canadian federal election"
replace district_name = "Medicine Hat--Cardston--Warner" if district_code == 48027 & election == "2015 Canadian federal election"
replace district_name = "Peace River--Westlock" if district_code == 48028 & election == "2015 Canadian federal election"
replace district_name = "Red Deer--Mountain View" if district_code == 48029 & election == "2015 Canadian federal election"
replace district_name = "Red Deer--Lacombe" if district_code == 48030 & election == "2015 Canadian federal election"
replace district_name = "St. Albert--Edmonton" if district_code == 48031 & election == "2015 Canadian federal election"
replace district_name = "Sherwood Park--Fort Saskatchewan" if district_code == 48032 & election == "2015 Canadian federal election"
replace district_name = "Sturgeon River--Parkland" if district_code == 48033 & election == "2015 Canadian federal election"
replace district_name = "Yellowhead" if district_code == 48034 & election == "2015 Canadian federal election"
replace district_name = "Abbotsford" if district_code == 59001 & election == "2015 Canadian federal election"
replace district_name = "Burnaby North--Seymour/Burnaby-Nord--Seymour" if district_code == 59002 & election == "2015 Canadian federal election"
replace district_name = "Burnaby South/Burnaby-Sud" if district_code == 59003 & election == "2015 Canadian federal election"
replace district_name = "Cariboo--Prince George" if district_code == 59004 & election == "2015 Canadian federal election"
replace district_name = "Central Okanagan--Similkameen--Nicola" if district_code == 59005 & election == "2015 Canadian federal election"
replace district_name = "Chilliwack--Hope" if district_code == 59006 & election == "2015 Canadian federal election"
replace district_name = "Cloverdale--Langley City" if district_code == 59007 & election == "2015 Canadian federal election"
replace district_name = "Coquitlam--Port Coquitlam" if district_code == 59008 & election == "2015 Canadian federal election"
replace district_name = "Courtenay--Alberni" if district_code == 59009 & election == "2015 Canadian federal election"
replace district_name = "Cowichan--Malahat--Langford" if district_code == 59010 & election == "2015 Canadian federal election"
replace district_name = "Delta" if district_code == 59011 & election == "2015 Canadian federal election"
replace district_name = "Fleetwood--Port Kells" if district_code == 59012 & election == "2015 Canadian federal election"
replace district_name = "Kamloops--Thompson--Cariboo" if district_code == 59013 & election == "2015 Canadian federal election"
replace district_name = "Kelowna--Lake Country" if district_code == 59014 & election == "2015 Canadian federal election"
replace district_name = "Kootenay--Columbia" if district_code == 59015 & election == "2015 Canadian federal election"
replace district_name = "Langley--Aldergrove" if district_code == 59016 & election == "2015 Canadian federal election"
replace district_name = "Mission--Matsqui--Fraser Canyon" if district_code == 59017 & election == "2015 Canadian federal election"
replace district_name = "Nanaimo--Ladysmith" if district_code == 59018 & election == "2015 Canadian federal election"
replace district_name = "New Westminster--Burnaby" if district_code == 59019 & election == "2015 Canadian federal election"
replace district_name = "North Okanagan--Shuswap" if district_code == 59020 & election == "2015 Canadian federal election"
replace district_name = "North Vancouver" if district_code == 59021 & election == "2015 Canadian federal election"
replace district_name = "Pitt Meadows--Maple Ridge" if district_code == 59022 & election == "2015 Canadian federal election"
replace district_name = "Port Moody--Coquitlam" if district_code == 59023 & election == "2015 Canadian federal election"
replace district_name = "Prince George--Peace River--Northern Rockies" if district_code == 59024 & election == "2015 Canadian federal election"
replace district_name = "Richmond Centre/Richmond-Centre" if district_code == 59025 & election == "2015 Canadian federal election"
replace district_name = "Esquimalt--Saanich--Sooke" if district_code == 59026 & election == "2015 Canadian federal election"
replace district_name = "Saanich--Gulf Islands" if district_code == 59027 & election == "2015 Canadian federal election"
replace district_name = "Skeena--Bulkley Valley" if district_code == 59028 & election == "2015 Canadian federal election"
replace district_name = "South Okanagan--West Kootenay/Okanagan-Sud--Kootenay-Ouest" if district_code == 59029 & election == "2015 Canadian federal election"
replace district_name = "South Surrey--White Rock/Surrey-Sud--White Rock" if district_code == 59030 & election == "2015 Canadian federal election"
replace district_name = "Steveston--Richmond East/Steveston--Richmond-Est" if district_code == 59031 & election == "2015 Canadian federal election"
replace district_name = "Surrey Centre/Surrey-Centre" if district_code == 59032 & election == "2015 Canadian federal election"
replace district_name = "Surrey--Newton" if district_code == 59033 & election == "2015 Canadian federal election"
replace district_name = "Vancouver Centre/Vancouver-Centre" if district_code == 59034 & election == "2015 Canadian federal election"
replace district_name = "Vancouver East/Vancouver-Est" if district_code == 59035 & election == "2015 Canadian federal election"
replace district_name = "Vancouver Granville" if district_code == 59036 & election == "2015 Canadian federal election"
replace district_name = "North Island--Powell River" if district_code == 59037 & election == "2015 Canadian federal election"
replace district_name = "Vancouver Kingsway" if district_code == 59038 & election == "2015 Canadian federal election"
replace district_name = "Vancouver Quadra" if district_code == 59039 & election == "2015 Canadian federal election"
replace district_name = "Vancouver South/Vancouver-Sud" if district_code == 59040 & election == "2015 Canadian federal election"
replace district_name = "Victoria" if district_code == 59041 & election == "2015 Canadian federal election"
replace district_name = "West Vancouver--Sunshine Coast--Sea to Sky Country" if district_code == 59042 & election == "2015 Canadian federal election"
replace district_name = "Yukon" if district_code == 60001 & election == "2015 Canadian federal election"
replace district_name = "Northwest Territories/Territoires du Nord-Ouest" if district_code == 61001 & election == "2015 Canadian federal election"
replace district_name = "Nunavut" if district_code == 62001 & election == "2015 Canadian federal election"
replace district_name = "Avalon" if district_code == 10001 & election == "2019 Canadian federal election"
replace district_name = "Bonavista--Burin--Trinity" if district_code == 10002 & election == "2019 Canadian federal election"
replace district_name = "Coast of Bays--Central--Notre Dame" if district_code == 10003 & election == "2019 Canadian federal election"
replace district_name = "Labrador" if district_code == 10004 & election == "2019 Canadian federal election"
replace district_name = "Long Range Mountains" if district_code == 10005 & election == "2019 Canadian federal election"
replace district_name = "St. John's East/St. John's-Est" if district_code == 10006 & election == "2019 Canadian federal election"
replace district_name = "St. John's South--Mount Pearl/St. John's-Sud--Mount Pearl" if district_code == 10007 & election == "2019 Canadian federal election"
replace district_name = "Cardigan" if district_code == 11001 & election == "2019 Canadian federal election"
replace district_name = "Charlottetown" if district_code == 11002 & election == "2019 Canadian federal election"
replace district_name = "Egmont" if district_code == 11003 & election == "2019 Canadian federal election"
replace district_name = "Malpeque" if district_code == 11004 & election == "2019 Canadian federal election"
replace district_name = "Cape Breton--Canso" if district_code == 12001 & election == "2019 Canadian federal election"
replace district_name = "Central Nova/Nova-Centre" if district_code == 12002 & election == "2019 Canadian federal election"
replace district_name = "Cumberland--Colchester" if district_code == 12003 & election == "2019 Canadian federal election"
replace district_name = "Dartmouth--Cole Harbour" if district_code == 12004 & election == "2019 Canadian federal election"
replace district_name = "Halifax" if district_code == 12005 & election == "2019 Canadian federal election"
replace district_name = "Halifax West/Halifax-Ouest" if district_code == 12006 & election == "2019 Canadian federal election"
replace district_name = "Kings--Hants" if district_code == 12007 & election == "2019 Canadian federal election"
replace district_name = "Sackville--Preston--Chezzetcook" if district_code == 12008 & election == "2019 Canadian federal election"
replace district_name = "South Shore--St. Margarets" if district_code == 12009 & election == "2019 Canadian federal election"
replace district_name = "Sydney--Victoria" if district_code == 12010 & election == "2019 Canadian federal election"
replace district_name = "West Nova/Nova-Ouest" if district_code == 12011 & election == "2019 Canadian federal election"
replace district_name = "Acadie--Bathurst" if district_code == 13001 & election == "2019 Canadian federal election"
replace district_name = "BeausÃ©jour" if district_code == 13002 & election == "2019 Canadian federal election"
replace district_name = "Fredericton" if district_code == 13003 & election == "2019 Canadian federal election"
replace district_name = "Fundy Royal" if district_code == 13004 & election == "2019 Canadian federal election"
replace district_name = "Madawaska--Restigouche" if district_code == 13005 & election == "2019 Canadian federal election"
replace district_name = "Miramichi--Grand Lake" if district_code == 13006 & election == "2019 Canadian federal election"
replace district_name = "Moncton--Riverview--Dieppe" if district_code == 13007 & election == "2019 Canadian federal election"
replace district_name = "New Brunswick Southwest/Nouveau-Brunswick-Sud-Ouest" if district_code == 13008 & election == "2019 Canadian federal election"
replace district_name = "Saint John--Rothesay" if district_code == 13009 & election == "2019 Canadian federal election"
replace district_name = "Tobique--Mactaquac" if district_code == 13010 & election == "2019 Canadian federal election"
replace district_name = "Abitibi--Baie-James--Nunavik--Eeyou" if district_code == 24001 & election == "2019 Canadian federal election"
replace district_name = "Abitibi--TÃ©miscamingue" if district_code == 24002 & election == "2019 Canadian federal election"
replace district_name = "Ahuntsic-Cartierville" if district_code == 24003 & election == "2019 Canadian federal election"
replace district_name = "Alfred-Pellan" if district_code == 24004 & election == "2019 Canadian federal election"
replace district_name = "Argenteuil--La Petite-Nation" if district_code == 24005 & election == "2019 Canadian federal election"
replace district_name = "Avignon--La Mitis--Matane--MatapÃ©dia" if district_code == 24006 & election == "2019 Canadian federal election"
replace district_name = "Beauce" if district_code == 24007 & election == "2019 Canadian federal election"
replace district_name = "Beauport--Limoilou" if district_code == 24008 & election == "2019 Canadian federal election"
replace district_name = "BÃ©cancour--Nicolet--Saurel" if district_code == 24009 & election == "2019 Canadian federal election"
replace district_name = "Bellechasse--Les Etchemins--LÃ©vis" if district_code == 24010 & election == "2019 Canadian federal election"
replace district_name = "Beloeil--Chambly" if district_code == 24011 & election == "2019 Canadian federal election"
replace district_name = "Berthier--MaskinongÃ©" if district_code == 24012 & election == "2019 Canadian federal election"
replace district_name = "ThÃ©rÃ¨se-De Blainville" if district_code == 24013 & election == "2019 Canadian federal election"
replace district_name = "Pierre-Boucher--Les Patriotes--VerchÃ¨res" if district_code == 24014 & election == "2019 Canadian federal election"
replace district_name = "Bourassa" if district_code == 24015 & election == "2019 Canadian federal election"
replace district_name = "Brome--Missisquoi" if district_code == 24016 & election == "2019 Canadian federal election"
replace district_name = "Brossard--Saint-Lambert" if district_code == 24017 & election == "2019 Canadian federal election"
replace district_name = "Rimouski-Neigette--TÃ©miscouata--Les Basques" if district_code == 24018 & election == "2019 Canadian federal election"
replace district_name = "Charlesbourg--Haute-Saint-Charles" if district_code == 24019 & election == "2019 Canadian federal election"
replace district_name = "Beauport-CÃ´te-de-BeauprÃ©-Ãle d'OrlÃ©ans-Charlevoix" if district_code == 24020 & election == "2019 Canadian federal election"
replace district_name = "ChÃ¢teauguay--Lacolle" if district_code == 24021 & election == "2019 Canadian federal election"
replace district_name = "Chicoutimi--Le Fjord" if district_code == 24022 & election == "2019 Canadian federal election"
replace district_name = "Compton--Stanstead" if district_code == 24023 & election == "2019 Canadian federal election"
replace district_name = "Dorval--Lachine--LaSalle" if district_code == 24024 & election == "2019 Canadian federal election"
replace district_name = "Drummond" if district_code == 24025 & election == "2019 Canadian federal election"
replace district_name = "GaspÃ©sie--Les Ãles-de-la-Madeleine" if district_code == 24026 & election == "2019 Canadian federal election"
replace district_name = "Gatineau" if district_code == 24027 & election == "2019 Canadian federal election"
replace district_name = "Hochelaga" if district_code == 24028 & election == "2019 Canadian federal election"
replace district_name = "HonorÃ©-Mercier" if district_code == 24029 & election == "2019 Canadian federal election"
replace district_name = "Hull--Aylmer" if district_code == 24030 & election == "2019 Canadian federal election"
replace district_name = "Joliette" if district_code == 24031 & election == "2019 Canadian federal election"
replace district_name = "JonquiÃ¨re" if district_code == 24032 & election == "2019 Canadian federal election"
replace district_name = "La Pointe-de-l'Ãle" if district_code == 24033 & election == "2019 Canadian federal election"
replace district_name = "La Prairie" if district_code == 24034 & election == "2019 Canadian federal election"
replace district_name = "Lac-Saint-Jean" if district_code == 24035 & election == "2019 Canadian federal election"
replace district_name = "Lac-Saint-Louis" if district_code == 24036 & election == "2019 Canadian federal election"
replace district_name = "LaSalle--Ãmard--Verdun" if district_code == 24037 & election == "2019 Canadian federal election"
replace district_name = "Laurentides--Labelle" if district_code == 24038 & election == "2019 Canadian federal election"
replace district_name = "Laurier--Sainte-Marie" if district_code == 24039 & election == "2019 Canadian federal election"
replace district_name = "Laval--Les Ãles" if district_code == 24040 & election == "2019 Canadian federal election"
replace district_name = "Longueuil--Charles-LeMoyne" if district_code == 24041 & election == "2019 Canadian federal election"
replace district_name = "LÃ©vis--LotbiniÃ¨re" if district_code == 24042 & election == "2019 Canadian federal election"
replace district_name = "Longueuil--Saint-Hubert" if district_code == 24043 & election == "2019 Canadian federal election"
replace district_name = "Louis-HÃ©bert" if district_code == 24044 & election == "2019 Canadian federal election"
replace district_name = "Louis-Saint-Laurent" if district_code == 24045 & election == "2019 Canadian federal election"
replace district_name = "Manicouagan" if district_code == 24046 & election == "2019 Canadian federal election"
replace district_name = "MÃ©gantic--L'Ãrable" if district_code == 24047 & election == "2019 Canadian federal election"
replace district_name = "Mirabel" if district_code == 24048 & election == "2019 Canadian federal election"
replace district_name = "Montarville" if district_code == 24049 & election == "2019 Canadian federal election"
replace district_name = "Montcalm" if district_code == 24050 & election == "2019 Canadian federal election"
replace district_name = "Montmagny--L'Islet--Kamouraska--RiviÃ¨re-du-Loup" if district_code == 24051 & election == "2019 Canadian federal election"
replace district_name = "Mount Royal/Mont-Royal" if district_code == 24052 & election == "2019 Canadian federal election"
replace district_name = "Notre-Dame-de-GrÃ¢ce--Westmount" if district_code == 24053 & election == "2019 Canadian federal election"
replace district_name = "Outremont" if district_code == 24054 & election == "2019 Canadian federal election"
replace district_name = "Papineau" if district_code == 24055 & election == "2019 Canadian federal election"
replace district_name = "Pierrefonds--Dollard" if district_code == 24056 & election == "2019 Canadian federal election"
replace district_name = "Pontiac" if district_code == 24057 & election == "2019 Canadian federal election"
replace district_name = "Portneuf--Jacques-Cartier" if district_code == 24058 & election == "2019 Canadian federal election"
replace district_name = "QuÃ©bec" if district_code == 24059 & election == "2019 Canadian federal election"
replace district_name = "Repentigny" if district_code == 24060 & election == "2019 Canadian federal election"
replace district_name = "Richmond--Arthabaska" if district_code == 24061 & election == "2019 Canadian federal election"
replace district_name = "RiviÃ¨re-des-Mille-Ãles" if district_code == 24062 & election == "2019 Canadian federal election"
replace district_name = "RiviÃ¨re-du-Nord" if district_code == 24063 & election == "2019 Canadian federal election"
replace district_name = "Rosemont--La Petite-Patrie" if district_code == 24064 & election == "2019 Canadian federal election"
replace district_name = "Marc-AurÃ¨le-Fortin" if district_code == 24065 & election == "2019 Canadian federal election"
replace district_name = "Saint-Hyacinthe--Bagot" if district_code == 24066 & election == "2019 Canadian federal election"
replace district_name = "Saint-Jean" if district_code == 24067 & election == "2019 Canadian federal election"
replace district_name = "Saint-Laurent" if district_code == 24068 & election == "2019 Canadian federal election"
replace district_name = "Saint-LÃ©onard--Saint-Michel" if district_code == 24069 & election == "2019 Canadian federal election"
replace district_name = "Saint-Maurice--Champlain" if district_code == 24070 & election == "2019 Canadian federal election"
replace district_name = "Salaberry--SuroÃ®t" if district_code == 24071 & election == "2019 Canadian federal election"
replace district_name = "Shefford" if district_code == 24072 & election == "2019 Canadian federal election"
replace district_name = "Sherbrooke" if district_code == 24073 & election == "2019 Canadian federal election"
replace district_name = "Vaudreuil--Soulanges" if district_code == 24074 & election == "2019 Canadian federal election"
replace district_name = "Terrebonne" if district_code == 24075 & election == "2019 Canadian federal election"
replace district_name = "Trois-RiviÃ¨res" if district_code == 24076 & election == "2019 Canadian federal election"
replace district_name = "Ville-Marie--Le Sud-Ouest--Ãle-des-Soeurs" if district_code == 24077 & election == "2019 Canadian federal election"
replace district_name = "Vimy" if district_code == 24078 & election == "2019 Canadian federal election"
replace district_name = "Ajax" if district_code == 35001 & election == "2019 Canadian federal election"
replace district_name = "Algoma--Manitoulin--Kapuskasing" if district_code == 35002 & election == "2019 Canadian federal election"
replace district_name = "Aurora--Oak Ridges--Richmond Hill" if district_code == 35003 & election == "2019 Canadian federal election"
replace district_name = "Barrie--Innisfil" if district_code == 35004 & election == "2019 Canadian federal election"
replace district_name = "Barrie--Springwater--Oro-Medonte" if district_code == 35005 & election == "2019 Canadian federal election"
replace district_name = "Bay of Quinte/Baie de Quinte" if district_code == 35006 & election == "2019 Canadian federal election"
replace district_name = "Beaches--East York" if district_code == 35007 & election == "2019 Canadian federal election"
replace district_name = "Brampton Centre/Brampton-Centre" if district_code == 35008 & election == "2019 Canadian federal election"
replace district_name = "Brampton East/Brampton-Est" if district_code == 35009 & election == "2019 Canadian federal election"
replace district_name = "Brampton North/Brampton-Nord" if district_code == 35010 & election == "2019 Canadian federal election"
replace district_name = "Brampton South/Brampton-Sud" if district_code == 35011 & election == "2019 Canadian federal election"
replace district_name = "Brampton West/Brampton-Ouest" if district_code == 35012 & election == "2019 Canadian federal election"
replace district_name = "Brantford--Brant" if district_code == 35013 & election == "2019 Canadian federal election"
replace district_name = "Bruce--Grey--Owen Sound" if district_code == 35014 & election == "2019 Canadian federal election"
replace district_name = "Burlington" if district_code == 35015 & election == "2019 Canadian federal election"
replace district_name = "Cambridge" if district_code == 35016 & election == "2019 Canadian federal election"
replace district_name = "Chatham-Kent--Leamington" if district_code == 35017 & election == "2019 Canadian federal election"
replace district_name = "Davenport" if district_code == 35018 & election == "2019 Canadian federal election"
replace district_name = "Don Valley East/Don Valley-Est" if district_code == 35019 & election == "2019 Canadian federal election"
replace district_name = "Don Valley North/Don Valley-Nord" if district_code == 35020 & election == "2019 Canadian federal election"
replace district_name = "Don Valley West/Don Valley-Ouest" if district_code == 35021 & election == "2019 Canadian federal election"
replace district_name = "Dufferin--Caledon" if district_code == 35022 & election == "2019 Canadian federal election"
replace district_name = "Durham" if district_code == 35023 & election == "2019 Canadian federal election"
replace district_name = "Eglinton--Lawrence" if district_code == 35024 & election == "2019 Canadian federal election"
replace district_name = "Elgin--Middlesex--London" if district_code == 35025 & election == "2019 Canadian federal election"
replace district_name = "Essex" if district_code == 35026 & election == "2019 Canadian federal election"
replace district_name = "Etobicoke Centre/Etobicoke-Centre" if district_code == 35027 & election == "2019 Canadian federal election"
replace district_name = "Etobicoke--Lakeshore" if district_code == 35028 & election == "2019 Canadian federal election"
replace district_name = "Etobicoke North/Etobicoke-Nord" if district_code == 35029 & election == "2019 Canadian federal election"
replace district_name = "Flamborough--Glanbrook" if district_code == 35030 & election == "2019 Canadian federal election"
replace district_name = "Glengarry--Prescott--Russell" if district_code == 35031 & election == "2019 Canadian federal election"
replace district_name = "Guelph" if district_code == 35032 & election == "2019 Canadian federal election"
replace district_name = "Haldimand--Norfolk" if district_code == 35033 & election == "2019 Canadian federal election"
replace district_name = "Haliburton--Kawartha Lakes--Brock" if district_code == 35034 & election == "2019 Canadian federal election"
replace district_name = "Hamilton Centre/Hamilton-Centre" if district_code == 35035 & election == "2019 Canadian federal election"
replace district_name = "Hamilton East--Stoney Creek/Hamilton-Est--Stoney Creek" if district_code == 35036 & election == "2019 Canadian federal election"
replace district_name = "Hamilton Mountain" if district_code == 35037 & election == "2019 Canadian federal election"
replace district_name = "Hamilton West--Ancaster--Dundas/Hamilton-Ouest--Ancaster--Dundas" if district_code == 35038 & election == "2019 Canadian federal election"
replace district_name = "Hastings--Lennox and Addington" if district_code == 35039 & election == "2019 Canadian federal election"
replace district_name = "Huron--Bruce" if district_code == 35040 & election == "2019 Canadian federal election"
replace district_name = "Kanata--Carleton" if district_code == 35041 & election == "2019 Canadian federal election"
replace district_name = "Kenora" if district_code == 35042 & election == "2019 Canadian federal election"
replace district_name = "King--Vaughan" if district_code == 35043 & election == "2019 Canadian federal election"
replace district_name = "Kingston and the Islands/Kingston et les Ãles" if district_code == 35044 & election == "2019 Canadian federal election"
replace district_name = "Kitchener Centre/Kitchener-Centre" if district_code == 35045 & election == "2019 Canadian federal election"
replace district_name = "Kitchener--Conestoga" if district_code == 35046 & election == "2019 Canadian federal election"
replace district_name = "Kitchener South--Hespeler/Kitchener-Sud--Hespeler" if district_code == 35047 & election == "2019 Canadian federal election"
replace district_name = "Lambton--Kent--Middlesex" if district_code == 35048 & election == "2019 Canadian federal election"
replace district_name = "Lanark--Frontenac--Kingston" if district_code == 35049 & election == "2019 Canadian federal election"
replace district_name = "Leeds--Grenville--Thousand Islands and Rideau Lakes/Leeds--Grenville--Thousand Islands et Rideau Lakes" if district_code == 35050 & election == "2019 Canadian federal election"
replace district_name = "London--Fanshawe" if district_code == 35051 & election == "2019 Canadian federal election"
replace district_name = "London North Centre/London-Centre-Nord" if district_code == 35052 & election == "2019 Canadian federal election"
replace district_name = "London West/London-Ouest" if district_code == 35053 & election == "2019 Canadian federal election"
replace district_name = "Markham--Stouffville" if district_code == 35054 & election == "2019 Canadian federal election"
replace district_name = "Markham--Thornhill" if district_code == 35055 & election == "2019 Canadian federal election"
replace district_name = "Markham--Unionville" if district_code == 35056 & election == "2019 Canadian federal election"
replace district_name = "Milton" if district_code == 35057 & election == "2019 Canadian federal election"
replace district_name = "Mississauga Centre/Mississauga-Centre" if district_code == 35058 & election == "2019 Canadian federal election"
replace district_name = "Mississauga East--Cooksville/Mississauga-Est--Cooksville" if district_code == 35059 & election == "2019 Canadian federal election"
replace district_name = "Mississauga--Erin Mills" if district_code == 35060 & election == "2019 Canadian federal election"
replace district_name = "Mississauga--Lakeshore" if district_code == 35061 & election == "2019 Canadian federal election"
replace district_name = "Mississauga--Malton" if district_code == 35062 & election == "2019 Canadian federal election"
replace district_name = "Mississauga--Streetsville" if district_code == 35063 & election == "2019 Canadian federal election"
replace district_name = "Nepean" if district_code == 35064 & election == "2019 Canadian federal election"
replace district_name = "Newmarket--Aurora" if district_code == 35065 & election == "2019 Canadian federal election"
replace district_name = "Niagara Centre/Niagara-Centre" if district_code == 35066 & election == "2019 Canadian federal election"
replace district_name = "Niagara Falls" if district_code == 35067 & election == "2019 Canadian federal election"
replace district_name = "Niagara West/Niagara-Ouest" if district_code == 35068 & election == "2019 Canadian federal election"
replace district_name = "Nickel Belt" if district_code == 35069 & election == "2019 Canadian federal election"
replace district_name = "Nipissing--Timiskaming" if district_code == 35070 & election == "2019 Canadian federal election"
replace district_name = "Northumberland--Peterborough South/Northumberland--Peterborough-Sud" if district_code == 35071 & election == "2019 Canadian federal election"
replace district_name = "Oakville" if district_code == 35072 & election == "2019 Canadian federal election"
replace district_name = "Oakville North--Burlington/Oakville-Nord--Burlington" if district_code == 35073 & election == "2019 Canadian federal election"
replace district_name = "Oshawa" if district_code == 35074 & election == "2019 Canadian federal election"
replace district_name = "Ottawa Centre/Ottawa-Centre" if district_code == 35075 & election == "2019 Canadian federal election"
replace district_name = "OrlÃ©ans" if district_code == 35076 & election == "2019 Canadian federal election"
replace district_name = "Ottawa South/Ottawa-Sud" if district_code == 35077 & election == "2019 Canadian federal election"
replace district_name = "Ottawa--Vanier" if district_code == 35078 & election == "2019 Canadian federal election"
replace district_name = "Ottawa West--Nepean/Ottawa-Ouest--Nepean" if district_code == 35079 & election == "2019 Canadian federal election"
replace district_name = "Oxford" if district_code == 35080 & election == "2019 Canadian federal election"
replace district_name = "Parkdale--High Park" if district_code == 35081 & election == "2019 Canadian federal election"
replace district_name = "Parry Sound--Muskoka" if district_code == 35082 & election == "2019 Canadian federal election"
replace district_name = "Perth--Wellington" if district_code == 35083 & election == "2019 Canadian federal election"
replace district_name = "Peterborough--Kawartha" if district_code == 35084 & election == "2019 Canadian federal election"
replace district_name = "Pickering--Uxbridge" if district_code == 35085 & election == "2019 Canadian federal election"
replace district_name = "Renfrew--Nipissing--Pembroke" if district_code == 35086 & election == "2019 Canadian federal election"
replace district_name = "Richmond Hill" if district_code == 35087 & election == "2019 Canadian federal election"
replace district_name = "Carleton" if district_code == 35088 & election == "2019 Canadian federal election"
replace district_name = "St. Catharines" if district_code == 35089 & election == "2019 Canadian federal election"
replace district_name = "Toronto--St. Paul's" if district_code == 35090 & election == "2019 Canadian federal election"
replace district_name = "Sarnia--Lambton" if district_code == 35091 & election == "2019 Canadian federal election"
replace district_name = "Sault Ste. Marie" if district_code == 35092 & election == "2019 Canadian federal election"
replace district_name = "Scarborough--Agincourt" if district_code == 35093 & election == "2019 Canadian federal election"
replace district_name = "Scarborough Centre/Scarborough-Centre" if district_code == 35094 & election == "2019 Canadian federal election"
replace district_name = "Scarborough--Guildwood" if district_code == 35095 & election == "2019 Canadian federal election"
replace district_name = "Scarborough North/Scarborough-Nord" if district_code == 35096 & election == "2019 Canadian federal election"
replace district_name = "Scarborough--Rouge Park" if district_code == 35097 & election == "2019 Canadian federal election"
replace district_name = "Scarborough Southwest/Scarborough-Sud-Ouest" if district_code == 35098 & election == "2019 Canadian federal election"
replace district_name = "Simcoe--Grey" if district_code == 35099 & election == "2019 Canadian federal election"
replace district_name = "Simcoe North/Simcoe-Nord" if district_code == 35100 & election == "2019 Canadian federal election"
replace district_name = "Spadina--Fort York" if district_code == 35101 & election == "2019 Canadian federal election"
replace district_name = "Stormont--Dundas--South Glengarry" if district_code == 35102 & election == "2019 Canadian federal election"
replace district_name = "Sudbury" if district_code == 35103 & election == "2019 Canadian federal election"
replace district_name = "Thornhill" if district_code == 35104 & election == "2019 Canadian federal election"
replace district_name = "Thunder Bay--Rainy River" if district_code == 35105 & election == "2019 Canadian federal election"
replace district_name = "Thunder Bay--Superior North/Thunder Bay--SupÃ©rieur-Nord" if district_code == 35106 & election == "2019 Canadian federal election"
replace district_name = "Timmins--James Bay/Timmins--Baie James" if district_code == 35107 & election == "2019 Canadian federal election"
replace district_name = "Toronto Centre/Toronto-Centre" if district_code == 35108 & election == "2019 Canadian federal election"
replace district_name = "Toronto--Danforth" if district_code == 35109 & election == "2019 Canadian federal election"
replace district_name = "University--Rosedale" if district_code == 35110 & election == "2019 Canadian federal election"
replace district_name = "Vaughan--Woodbridge" if district_code == 35111 & election == "2019 Canadian federal election"
replace district_name = "Waterloo" if district_code == 35112 & election == "2019 Canadian federal election"
replace district_name = "Wellington--Halton Hills" if district_code == 35113 & election == "2019 Canadian federal election"
replace district_name = "Whitby" if district_code == 35114 & election == "2019 Canadian federal election"
replace district_name = "Willowdale" if district_code == 35115 & election == "2019 Canadian federal election"
replace district_name = "Windsor--Tecumseh" if district_code == 35116 & election == "2019 Canadian federal election"
replace district_name = "Windsor West/Windsor-Ouest" if district_code == 35117 & election == "2019 Canadian federal election"
replace district_name = "York Centre/York-Centre" if district_code == 35118 & election == "2019 Canadian federal election"
replace district_name = "York--Simcoe" if district_code == 35119 & election == "2019 Canadian federal election"
replace district_name = "York South--Weston/York-Sud--Weston" if district_code == 35120 & election == "2019 Canadian federal election"
replace district_name = "Humber River--Black Creek" if district_code == 35121 & election == "2019 Canadian federal election"
replace district_name = "Brandon--Souris" if district_code == 46001 & election == "2019 Canadian federal election"
replace district_name = "Charleswood--St. James--Assiniboia--Headingley" if district_code == 46002 & election == "2019 Canadian federal election"
replace district_name = "Churchill--Keewatinook Aski" if district_code == 46003 & election == "2019 Canadian federal election"
replace district_name = "Dauphin--Swan River--Neepawa" if district_code == 46004 & election == "2019 Canadian federal election"
replace district_name = "Elmwood--Transcona" if district_code == 46005 & election == "2019 Canadian federal election"
replace district_name = "Kildonan--St. Paul" if district_code == 46006 & election == "2019 Canadian federal election"
replace district_name = "Portage--Lisgar" if district_code == 46007 & election == "2019 Canadian federal election"
replace district_name = "Provencher" if district_code == 46008 & election == "2019 Canadian federal election"
replace district_name = "Saint Boniface--Saint Vital/Saint-Boniface--Saint-Vital" if district_code == 46009 & election == "2019 Canadian federal election"
replace district_name = "Selkirk--Interlake--Eastman" if district_code == 46010 & election == "2019 Canadian federal election"
replace district_name = "Winnipeg Centre/Winnipeg-Centre" if district_code == 46011 & election == "2019 Canadian federal election"
replace district_name = "Winnipeg North/Winnipeg-Nord" if district_code == 46012 & election == "2019 Canadian federal election"
replace district_name = "Winnipeg South/Winnipeg-Sud" if district_code == 46013 & election == "2019 Canadian federal election"
replace district_name = "Winnipeg South Centre/Winnipeg-Centre-Sud" if district_code == 46014 & election == "2019 Canadian federal election"
replace district_name = "Battlefords--Lloydminster" if district_code == 47001 & election == "2019 Canadian federal election"
replace district_name = "Cypress Hills--Grasslands" if district_code == 47002 & election == "2019 Canadian federal election"
replace district_name = "DesnethÃ©--Missinippi--Churchill River/DesnethÃ©--Missinippi--RiviÃ¨re Churchill" if district_code == 47003 & election == "2019 Canadian federal election"
replace district_name = "Carlton Trail--Eagle Creek/Sentier Carlton--Eagle Creek" if district_code == 47004 & election == "2019 Canadian federal election"
replace district_name = "Moose Jaw--Lake Centre--Lanigan" if district_code == 47005 & election == "2019 Canadian federal election"
replace district_name = "Prince Albert" if district_code == 47006 & election == "2019 Canadian federal election"
replace district_name = "Regina--Lewvan" if district_code == 47007 & election == "2019 Canadian federal election"
replace district_name = "Regina--Qu'Appelle" if district_code == 47008 & election == "2019 Canadian federal election"
replace district_name = "Regina--Wascana" if district_code == 47009 & election == "2019 Canadian federal election"
replace district_name = "Saskatoon--Grasswood" if district_code == 47010 & election == "2019 Canadian federal election"
replace district_name = "Saskatoon--University" if district_code == 47011 & election == "2019 Canadian federal election"
replace district_name = "Saskatoon West/Saskatoon-Ouest" if district_code == 47012 & election == "2019 Canadian federal election"
replace district_name = "Souris--Moose Mountain" if district_code == 47013 & election == "2019 Canadian federal election"
replace district_name = "Yorkton--Melville" if district_code == 47014 & election == "2019 Canadian federal election"
replace district_name = "Banff--Airdrie" if district_code == 48001 & election == "2019 Canadian federal election"
replace district_name = "Battle River--Crowfoot" if district_code == 48002 & election == "2019 Canadian federal election"
replace district_name = "Bow River" if district_code == 48003 & election == "2019 Canadian federal election"
replace district_name = "Calgary Centre/Calgary-Centre" if district_code == 48004 & election == "2019 Canadian federal election"
replace district_name = "Calgary Confederation" if district_code == 48005 & election == "2019 Canadian federal election"
replace district_name = "Calgary Forest Lawn" if district_code == 48006 & election == "2019 Canadian federal election"
replace district_name = "Calgary Heritage" if district_code == 48007 & election == "2019 Canadian federal election"
replace district_name = "Calgary Midnapore" if district_code == 48008 & election == "2019 Canadian federal election"
replace district_name = "Calgary Nose Hill" if district_code == 48009 & election == "2019 Canadian federal election"
replace district_name = "Calgary Rocky Ridge" if district_code == 48010 & election == "2019 Canadian federal election"
replace district_name = "Calgary Shepard" if district_code == 48011 & election == "2019 Canadian federal election"
replace district_name = "Calgary Signal Hill" if district_code == 48012 & election == "2019 Canadian federal election"
replace district_name = "Calgary Skyview" if district_code == 48013 & election == "2019 Canadian federal election"
replace district_name = "Edmonton Centre/Edmonton-Centre" if district_code == 48014 & election == "2019 Canadian federal election"
replace district_name = "Edmonton Griesbach" if district_code == 48015 & election == "2019 Canadian federal election"
replace district_name = "Edmonton Manning" if district_code == 48016 & election == "2019 Canadian federal election"
replace district_name = "Edmonton Mill Woods" if district_code == 48017 & election == "2019 Canadian federal election"
replace district_name = "Edmonton Riverbend" if district_code == 48018 & election == "2019 Canadian federal election"
replace district_name = "Edmonton Strathcona" if district_code == 48019 & election == "2019 Canadian federal election"
replace district_name = "Edmonton West/Edmonton-Ouest" if district_code == 48020 & election == "2019 Canadian federal election"
replace district_name = "Edmonton--Wetaskiwin" if district_code == 48021 & election == "2019 Canadian federal election"
replace district_name = "Foothills" if district_code == 48022 & election == "2019 Canadian federal election"
replace district_name = "Fort McMurray--Cold Lake" if district_code == 48023 & election == "2019 Canadian federal election"
replace district_name = "Grande Prairie--Mackenzie" if district_code == 48024 & election == "2019 Canadian federal election"
replace district_name = "Lakeland" if district_code == 48025 & election == "2019 Canadian federal election"
replace district_name = "Lethbridge" if district_code == 48026 & election == "2019 Canadian federal election"
replace district_name = "Medicine Hat--Cardston--Warner" if district_code == 48027 & election == "2019 Canadian federal election"
replace district_name = "Peace River--Westlock" if district_code == 48028 & election == "2019 Canadian federal election"
replace district_name = "Red Deer--Mountain View" if district_code == 48029 & election == "2019 Canadian federal election"
replace district_name = "Red Deer--Lacombe" if district_code == 48030 & election == "2019 Canadian federal election"
replace district_name = "St. Albert--Edmonton" if district_code == 48031 & election == "2019 Canadian federal election"
replace district_name = "Sherwood Park--Fort Saskatchewan" if district_code == 48032 & election == "2019 Canadian federal election"
replace district_name = "Sturgeon River--Parkland" if district_code == 48033 & election == "2019 Canadian federal election"
replace district_name = "Yellowhead" if district_code == 48034 & election == "2019 Canadian federal election"
replace district_name = "Abbotsford" if district_code == 59001 & election == "2019 Canadian federal election"
replace district_name = "Burnaby North--Seymour/Burnaby-Nord--Seymour" if district_code == 59002 & election == "2019 Canadian federal election"
replace district_name = "Burnaby South/Burnaby-Sud" if district_code == 59003 & election == "2019 Canadian federal election"
replace district_name = "Cariboo--Prince George" if district_code == 59004 & election == "2019 Canadian federal election"
replace district_name = "Central Okanagan--Similkameen--Nicola" if district_code == 59005 & election == "2019 Canadian federal election"
replace district_name = "Chilliwack--Hope" if district_code == 59006 & election == "2019 Canadian federal election"
replace district_name = "Cloverdale--Langley City" if district_code == 59007 & election == "2019 Canadian federal election"
replace district_name = "Coquitlam--Port Coquitlam" if district_code == 59008 & election == "2019 Canadian federal election"
replace district_name = "Courtenay--Alberni" if district_code == 59009 & election == "2019 Canadian federal election"
replace district_name = "Cowichan--Malahat--Langford" if district_code == 59010 & election == "2019 Canadian federal election"
replace district_name = "Delta" if district_code == 59011 & election == "2019 Canadian federal election"
replace district_name = "Fleetwood--Port Kells" if district_code == 59012 & election == "2019 Canadian federal election"
replace district_name = "Kamloops--Thompson--Cariboo" if district_code == 59013 & election == "2019 Canadian federal election"
replace district_name = "Kelowna--Lake Country" if district_code == 59014 & election == "2019 Canadian federal election"
replace district_name = "Kootenay--Columbia" if district_code == 59015 & election == "2019 Canadian federal election"
replace district_name = "Langley--Aldergrove" if district_code == 59016 & election == "2019 Canadian federal election"
replace district_name = "Mission--Matsqui--Fraser Canyon" if district_code == 59017 & election == "2019 Canadian federal election"
replace district_name = "Nanaimo--Ladysmith" if district_code == 59018 & election == "2019 Canadian federal election"
replace district_name = "New Westminster--Burnaby" if district_code == 59019 & election == "2019 Canadian federal election"
replace district_name = "North Okanagan--Shuswap" if district_code == 59020 & election == "2019 Canadian federal election"
replace district_name = "North Vancouver" if district_code == 59021 & election == "2019 Canadian federal election"
replace district_name = "Pitt Meadows--Maple Ridge" if district_code == 59022 & election == "2019 Canadian federal election"
replace district_name = "Port Moody--Coquitlam" if district_code == 59023 & election == "2019 Canadian federal election"
replace district_name = "Prince George--Peace River--Northern Rockies" if district_code == 59024 & election == "2019 Canadian federal election"
replace district_name = "Richmond Centre/Richmond-Centre" if district_code == 59025 & election == "2019 Canadian federal election"
replace district_name = "Esquimalt--Saanich--Sooke" if district_code == 59026 & election == "2019 Canadian federal election"
replace district_name = "Saanich--Gulf Islands" if district_code == 59027 & election == "2019 Canadian federal election"
replace district_name = "Skeena--Bulkley Valley" if district_code == 59028 & election == "2019 Canadian federal election"
replace district_name = "South Okanagan--West Kootenay/Okanagan-Sud--Kootenay-Ouest" if district_code == 59029 & election == "2019 Canadian federal election"
replace district_name = "South Surrey--White Rock/Surrey-Sud--White Rock" if district_code == 59030 & election == "2019 Canadian federal election"
replace district_name = "Steveston--Richmond East/Steveston--Richmond-Est" if district_code == 59031 & election == "2019 Canadian federal election"
replace district_name = "Surrey Centre/Surrey-Centre" if district_code == 59032 & election == "2019 Canadian federal election"
replace district_name = "Surrey--Newton" if district_code == 59033 & election == "2019 Canadian federal election"
replace district_name = "Vancouver Centre/Vancouver-Centre" if district_code == 59034 & election == "2019 Canadian federal election"
replace district_name = "Vancouver East/Vancouver-Est" if district_code == 59035 & election == "2019 Canadian federal election"
replace district_name = "Vancouver Granville" if district_code == 59036 & election == "2019 Canadian federal election"
replace district_name = "North Island--Powell River" if district_code == 59037 & election == "2019 Canadian federal election"
replace district_name = "Vancouver Kingsway" if district_code == 59038 & election == "2019 Canadian federal election"
replace district_name = "Vancouver Quadra" if district_code == 59039 & election == "2019 Canadian federal election"
replace district_name = "Vancouver South/Vancouver-Sud" if district_code == 59040 & election == "2019 Canadian federal election"
replace district_name = "Victoria" if district_code == 59041 & election == "2019 Canadian federal election"
replace district_name = "West Vancouver--Sunshine Coast--Sea to Sky Country" if district_code == 59042 & election == "2019 Canadian federal election"
replace district_name = "Yukon" if district_code == 60001 & election == "2019 Canadian federal election"
replace district_name = "Northwest Territories/Territoires du Nord-Ouest" if district_code == 61001 & election == "2019 Canadian federal election"
replace district_name = "Nunavut" if district_code == 62001 & election == "2019 Canadian federal election"
replace district_name = "abitibi" if district_code == 1 & election == "1988 Canadian federal election"
replace district_name = "ahuntsic" if district_code == 2 & election == "1988 Canadian federal election"
replace district_name = "algoma" if district_code == 3 & election == "1988 Canadian federal election"
replace district_name = "anjou--rivière-des-prairies" if district_code == 4 & election == "1988 Canadian federal election"
replace district_name = "annapolis valley--hants" if district_code == 5 & election == "1988 Canadian federal election"
replace district_name = "argenteuil--papineau" if district_code == 6 & election == "1988 Canadian federal election"
replace district_name = "athabasca" if district_code == 7 & election == "1988 Canadian federal election"
replace district_name = "beaches--woodbine" if district_code == 8 & election == "1988 Canadian federal election"
replace district_name = "beauce" if district_code == 9 & election == "1988 Canadian federal election"
replace district_name = "beauharnois--salaberry" if district_code == 10 & election == "1988 Canadian federal election"
replace district_name = "beauséjour" if district_code == 11 & election == "1988 Canadian federal election"
replace district_name = "beaver river" if district_code == 12 & election == "1988 Canadian federal election"
replace district_name = "bellechasse" if district_code == 13 & election == "1988 Canadian federal election"
replace district_name = "berthier--montcalm" if district_code == 14 & election == "1988 Canadian federal election"
replace district_name = "blainville--deux-montagnes" if district_code == 15 & election == "1988 Canadian federal election"
replace district_name = "bonaventure--Îles-de-la-madeleine" if district_code == 16 & election == "1988 Canadian federal election"
replace district_name = "bonavista--trinity--conception" if district_code == 17 & election == "1988 Canadian federal election"
replace district_name = "bourassa" if district_code == 18 & election == "1988 Canadian federal election"
replace district_name = "brampton" if district_code == 19 & election == "1988 Canadian federal election"
replace district_name = "brampton--malton" if district_code == 20 & election == "1988 Canadian federal election"
replace district_name = "brandon--souris" if district_code == 21 & election == "1988 Canadian federal election"
replace district_name = "brant" if district_code == 22 & election == "1988 Canadian federal election"
replace district_name = "broadview--greenwood" if district_code == 23 & election == "1988 Canadian federal election"
replace district_name = "brome--missisquoi" if district_code == 24 & election == "1988 Canadian federal election"
replace district_name = "bruce--grey" if district_code == 25 & election == "1988 Canadian federal election"
replace district_name = "burin--st. george's" if district_code == 26 & election == "1988 Canadian federal election"
replace district_name = "burlington" if district_code == 27 & election == "1988 Canadian federal election"
replace district_name = "burnaby--kingsway" if district_code == 28 & election == "1988 Canadian federal election"
replace district_name = "calgary centre" if district_code == 29 & election == "1988 Canadian federal election"
replace district_name = "calgary north/calgary-nord" if district_code == 30 & election == "1988 Canadian federal election"
replace district_name = "calgary northeast/calgary-nord-est" if district_code == 31 & election == "1988 Canadian federal election"
replace district_name = "calgary southeast" if district_code == 32 & election == "1988 Canadian federal election"
replace district_name = "calgary southwest" if district_code == 33 & election == "1988 Canadian federal election"
replace district_name = "calgary west" if district_code == 34 & election == "1988 Canadian federal election"
replace district_name = "cambridge" if district_code == 35 & election == "1988 Canadian federal election"
replace district_name = "cape breton highlands--canso" if district_code == 36 & election == "1988 Canadian federal election"
replace district_name = "cape breton--east richmond" if district_code == 37 & election == "1988 Canadian federal election"
replace district_name = "cape breton--the sydneys" if district_code == 38 & election == "1988 Canadian federal election"
replace district_name = "capilano--howe sound" if district_code == 39 & election == "1988 Canadian federal election"
replace district_name = "cardigan" if district_code == 40 & election == "1988 Canadian federal election"
replace district_name = "cariboo--chilcotin" if district_code == 41 & election == "1988 Canadian federal election"
replace district_name = "carleton--charlotte" if district_code == 42 & election == "1988 Canadian federal election"
replace district_name = "carleton--gloucester" if district_code == 43 & election == "1988 Canadian federal election"
replace district_name = "central nova" if district_code == 44 & election == "1988 Canadian federal election"
replace district_name = "chambly" if district_code == 45 & election == "1988 Canadian federal election"
replace district_name = "champlain" if district_code == 46 & election == "1988 Canadian federal election"
replace district_name = "charlesbourg" if district_code == 47 & election == "1988 Canadian federal election"
replace district_name = "charlevoix" if district_code == 48 & election == "1988 Canadian federal election"
replace district_name = "chicoutimi" if district_code == 49 & election == "1988 Canadian federal election"
replace district_name = "churchill" if district_code == 50 & election == "1988 Canadian federal election"
replace district_name = "châteauguay" if district_code == 51 & election == "1988 Canadian federal election"
replace district_name = "cochrane--superior" if district_code == 52 & election == "1988 Canadian federal election"
replace district_name = "comox--alberni" if district_code == 53 & election == "1988 Canadian federal election"
replace district_name = "crowfoot" if district_code == 54 & election == "1988 Canadian federal election"
replace district_name = "cumberland--colchester" if district_code == 55 & election == "1988 Canadian federal election"
replace district_name = "dartmouth" if district_code == 56 & election == "1988 Canadian federal election"
replace district_name = "dauphin--swan river" if district_code == 57 & election == "1988 Canadian federal election"
replace district_name = "davenport" if district_code == 58 & election == "1988 Canadian federal election"
replace district_name = "delta--richmond east/delta--richmond-est" if district_code == 59 & election == "1988 Canadian federal election"
replace district_name = "don valley east" if district_code == 60 & election == "1988 Canadian federal election"
replace district_name = "don valley north" if district_code == 61 & election == "1988 Canadian federal election"
replace district_name = "don valley west" if district_code == 62 & election == "1988 Canadian federal election"
replace district_name = "drummond" if district_code == 63 & election == "1988 Canadian federal election"
replace district_name = "durham" if district_code == 64 & election == "1988 Canadian federal election"
replace district_name = "duvernay" if district_code == 65 & election == "1988 Canadian federal election"
replace district_name = "edmonton east" if district_code == 66 & election == "1988 Canadian federal election"
replace district_name = "edmonton north" if district_code == 67 & election == "1988 Canadian federal election"
replace district_name = "edmonton northwest" if district_code == 68 & election == "1988 Canadian federal election"
replace district_name = "edmonton southeast" if district_code == 69 & election == "1988 Canadian federal election"
replace district_name = "edmonton southwest" if district_code == 70 & election == "1988 Canadian federal election"
replace district_name = "edmonton--strathcona" if district_code == 71 & election == "1988 Canadian federal election"
replace district_name = "eglinton--lawrence" if district_code == 72 & election == "1988 Canadian federal election"
replace district_name = "egmont" if district_code == 73 & election == "1988 Canadian federal election"
replace district_name = "elgin" if district_code == 74 & election == "1988 Canadian federal election"
replace district_name = "elk island" if district_code == 75 & election == "1988 Canadian federal election"
replace district_name = "erie" if district_code == 76 & election == "1988 Canadian federal election"
replace district_name = "esquimalt--juan de fuca" if district_code == 77 & election == "1988 Canadian federal election"
replace district_name = "essex--kent" if district_code == 78 & election == "1988 Canadian federal election"
replace district_name = "essex--windsor" if district_code == 79 & election == "1988 Canadian federal election"
replace district_name = "etobicoke centre" if district_code == 80 & election == "1988 Canadian federal election"
replace district_name = "etobicoke north" if district_code == 81 & election == "1988 Canadian federal election"
replace district_name = "etobicoke--lakeshore" if district_code == 82 & election == "1988 Canadian federal election"
replace district_name = "fraser valley east" if district_code == 83 & election == "1988 Canadian federal election"
replace district_name = "fraser valley west" if district_code == 84 & election == "1988 Canadian federal election"
replace district_name = "fredericton" if district_code == 85 & election == "1988 Canadian federal election"
replace district_name = "frontenac" if district_code == 86 & election == "1988 Canadian federal election"
replace district_name = "fundy--royal" if district_code == 87 & election == "1988 Canadian federal election"
replace district_name = "gander--grand falls" if district_code == 88 & election == "1988 Canadian federal election"
replace district_name = "gaspé" if district_code == 89 & election == "1988 Canadian federal election"
replace district_name = "gatineau--la lièvre" if district_code == 90 & election == "1988 Canadian federal election"
replace district_name = "glengarry--prescott--russell" if district_code == 91 & election == "1988 Canadian federal election"
replace district_name = "gloucester" if district_code == 92 & election == "1988 Canadian federal election"
replace district_name = "guelph--wellington" if district_code == 93 & election == "1988 Canadian federal election"
replace district_name = "haldimand--norfolk" if district_code == 94 & election == "1988 Canadian federal election"
replace district_name = "halifax" if district_code == 95 & election == "1988 Canadian federal election"
replace district_name = "halifax west" if district_code == 96 & election == "1988 Canadian federal election"
replace district_name = "halton--peel" if district_code == 97 & election == "1988 Canadian federal election"
replace district_name = "hamilton east" if district_code == 98 & election == "1988 Canadian federal election"
replace district_name = "hamilton mountain" if district_code == 99 & election == "1988 Canadian federal election"
replace district_name = "hamilton west" if district_code == 100 & election == "1988 Canadian federal election"
replace district_name = "hamilton--wentworth" if district_code == 101 & election == "1988 Canadian federal election"
replace district_name = "hastings--frontenac--lennox and addington" if district_code == 102 & election == "1988 Canadian federal election"
replace district_name = "hillsborough" if district_code == 103 & election == "1988 Canadian federal election"
replace district_name = "hochelaga--maisonneuve" if district_code == 104 & election == "1988 Canadian federal election"
replace district_name = "hull--aylmer" if district_code == 105 & election == "1988 Canadian federal election"
replace district_name = "humber--st. barbe--baie verte" if district_code == 106 & election == "1988 Canadian federal election"
replace district_name = "huron--bruce" if district_code == 107 & election == "1988 Canadian federal election"
replace district_name = "joliette" if district_code == 108 & election == "1988 Canadian federal election"
replace district_name = "jonquière" if district_code == 109 & election == "1988 Canadian federal election"
replace district_name = "kamloops" if district_code == 110 & election == "1988 Canadian federal election"
replace district_name = "kamouraska--rivière-du-loup" if district_code == 111 & election == "1988 Canadian federal election"
replace district_name = "kenora--rainy river" if district_code == 112 & election == "1988 Canadian federal election"
replace district_name = "kent" if district_code == 113 & election == "1988 Canadian federal election"
replace district_name = "kindersley--lloydminster" if district_code == 114 & election == "1988 Canadian federal election"
replace district_name = "kingston and the islands" if district_code == 115 & election == "1988 Canadian federal election"
replace district_name = "kitchener" if district_code == 116 & election == "1988 Canadian federal election"
replace district_name = "kootenay east" if district_code == 117 & election == "1988 Canadian federal election"
replace district_name = "kootenay west--revelstoke" if district_code == 118 & election == "1988 Canadian federal election"
replace district_name = "la prairie" if district_code == 119 & election == "1988 Canadian federal election"
replace district_name = "labrador" if district_code == 120 & election == "1988 Canadian federal election"
replace district_name = "lac-saint-jean" if district_code == 121 & election == "1988 Canadian federal election"
replace district_name = "lachine--lac-saint-louis" if district_code == 122 & election == "1988 Canadian federal election"
replace district_name = "lambton--kent--middlesex" if district_code == 123 & election == "1988 Canadian federal election"
replace district_name = "lanark--renfrew--carleton" if district_code == 124 & election == "1988 Canadian federal election"
replace district_name = "langelier" if district_code == 125 & election == "1988 Canadian federal election"
replace district_name = "lasalle--émard" if district_code == 126 & election == "1988 Canadian federal election"
replace district_name = "laurentides" if district_code == 127 & election == "1988 Canadian federal election"
replace district_name = "laurier--sainte-marie" if district_code == 128 & election == "1988 Canadian federal election"
replace district_name = "laval" if district_code == 129 & election == "1988 Canadian federal election"
replace district_name = "laval-des-rapides" if district_code == 130 & election == "1988 Canadian federal election"
replace district_name = "leeds--grenville" if district_code == 131 & election == "1988 Canadian federal election"
replace district_name = "lethbridge" if district_code == 132 & election == "1988 Canadian federal election"
replace district_name = "lincoln" if district_code == 133 & election == "1988 Canadian federal election"
replace district_name = "lisgar--marquette" if district_code == 134 & election == "1988 Canadian federal election"
replace district_name = "london east" if district_code == 135 & election == "1988 Canadian federal election"
replace district_name = "london west" if district_code == 136 & election == "1988 Canadian federal election"
replace district_name = "london--middlesex" if district_code == 137 & election == "1988 Canadian federal election"
replace district_name = "longueuil" if district_code == 138 & election == "1988 Canadian federal election"
replace district_name = "lotbinière" if district_code == 139 & election == "1988 Canadian federal election"
replace district_name = "louis-hébert" if district_code == 140 & election == "1988 Canadian federal election"
replace district_name = "lévis" if district_code == 141 & election == "1988 Canadian federal election"
replace district_name = "mackenzie" if district_code == 142 & election == "1988 Canadian federal election"
replace district_name = "macleod" if district_code == 143 & election == "1988 Canadian federal election"
replace district_name = "madawaska--victoria" if district_code == 144 & election == "1988 Canadian federal election"
replace district_name = "malpeque" if district_code == 145 & election == "1988 Canadian federal election"
replace district_name = "manicouagan" if district_code == 146 & election == "1988 Canadian federal election"
replace district_name = "markham" if district_code == 147 & election == "1988 Canadian federal election"
replace district_name = "matapédia--matane" if district_code == 148 & election == "1988 Canadian federal election"
replace district_name = "medicine hat" if district_code == 149 & election == "1988 Canadian federal election"
replace district_name = "mercier" if district_code == 150 & election == "1988 Canadian federal election"
replace district_name = "miramichi" if district_code == 151 & election == "1988 Canadian federal election"
replace district_name = "mission--coquitlam" if district_code == 152 & election == "1988 Canadian federal election"
replace district_name = "mississauga east" if district_code == 153 & election == "1988 Canadian federal election"
replace district_name = "mississauga south" if district_code == 154 & election == "1988 Canadian federal election"
replace district_name = "mississauga west" if district_code == 155 & election == "1988 Canadian federal election"
replace district_name = "moncton" if district_code == 156 & election == "1988 Canadian federal election"
replace district_name = "montmorency--orléans" if district_code == 157 & election == "1988 Canadian federal election"
replace district_name = "moose jaw--lake centre" if district_code == 158 & election == "1988 Canadian federal election"
replace district_name = "mount royal" if district_code == 159 & election == "1988 Canadian federal election"
replace district_name = "mégantic--compton--stanstead" if district_code == 160 & election == "1988 Canadian federal election"
replace district_name = "nanaimo--cowichan" if district_code == 161 & election == "1988 Canadian federal election"
replace district_name = "nepean" if district_code == 162 & election == "1988 Canadian federal election"
replace district_name = "new westminster--burnaby" if district_code == 163 & election == "1988 Canadian federal election"
replace district_name = "niagara falls" if district_code == 164 & election == "1988 Canadian federal election"
replace district_name = "nickel belt" if district_code == 165 & election == "1988 Canadian federal election"
replace district_name = "nipissing" if district_code == 166 & election == "1988 Canadian federal election"
replace district_name = "north island--powell river" if district_code == 167 & election == "1988 Canadian federal election"
replace district_name = "north vancouver" if district_code == 168 & election == "1988 Canadian federal election"
replace district_name = "northumberland" if district_code == 169 & election == "1988 Canadian federal election"
replace district_name = "notre-dame-de-grâce" if district_code == 170 & election == "1988 Canadian federal election"
replace district_name = "nunatsiaq" if district_code == 171 & election == "1988 Canadian federal election"
replace district_name = "oakville--milton" if district_code == 172 & election == "1988 Canadian federal election"
replace district_name = "okanagan centre" if district_code == 173 & election == "1988 Canadian federal election"
replace district_name = "okanagan--shuswap" if district_code == 174 & election == "1988 Canadian federal election"
replace district_name = "okanagan--similkameen--merritt" if district_code == 175 & election == "1988 Canadian federal election"
replace district_name = "ontario" if district_code == 176 & election == "1988 Canadian federal election"
replace district_name = "oshawa" if district_code == 177 & election == "1988 Canadian federal election"
replace district_name = "ottawa centre" if district_code == 178 & election == "1988 Canadian federal election"
replace district_name = "ottawa south" if district_code == 179 & election == "1988 Canadian federal election"
replace district_name = "ottawa west" if district_code == 180 & election == "1988 Canadian federal election"
replace district_name = "ottawa--vanier" if district_code == 181 & election == "1988 Canadian federal election"
replace district_name = "outremont" if district_code == 182 & election == "1988 Canadian federal election"
replace district_name = "oxford" if district_code == 183 & election == "1988 Canadian federal election"
replace district_name = "papineau--saint-michel" if district_code == 184 & election == "1988 Canadian federal election"
replace district_name = "parkdale--high park" if district_code == 185 & election == "1988 Canadian federal election"
replace district_name = "parry sound--muskoka" if district_code == 186 & election == "1988 Canadian federal election"
replace district_name = "peace river" if district_code == 187 & election == "1988 Canadian federal election"
replace district_name = "perth--wellington--waterloo" if district_code == 188 & election == "1988 Canadian federal election"
replace district_name = "peterborough" if district_code == 189 & election == "1988 Canadian federal election"
replace district_name = "pierrefonds--dollard" if district_code == 190 & election == "1988 Canadian federal election"
replace district_name = "pontiac--gatineau--labelle" if district_code == 191 & election == "1988 Canadian federal election"
replace district_name = "port moody--coquitlam" if district_code == 192 & election == "1988 Canadian federal election"
replace district_name = "portage--interlake" if district_code == 193 & election == "1988 Canadian federal election"
replace district_name = "portneuf" if district_code == 194 & election == "1988 Canadian federal election"
replace district_name = "prince albert--churchill river" if district_code == 195 & election == "1988 Canadian federal election"
replace district_name = "prince edward--hastings" if district_code == 196 & election == "1988 Canadian federal election"
replace district_name = "prince george--bulkley valley" if district_code == 197 & election == "1988 Canadian federal election"
replace district_name = "prince george--peace river" if district_code == 198 & election == "1988 Canadian federal election"
replace district_name = "provencher" if district_code == 199 & election == "1988 Canadian federal election"
replace district_name = "québec-est" if district_code == 200 & election == "1988 Canadian federal election"
replace district_name = "red deer" if district_code == 201 & election == "1988 Canadian federal election"
replace district_name = "regina--lumsden" if district_code == 202 & election == "1988 Canadian federal election"
replace district_name = "regina--qu'appelle" if district_code == 203 & election == "1988 Canadian federal election"
replace district_name = "regina--wascana" if district_code == 204 & election == "1988 Canadian federal election"
replace district_name = "renfrew--nipissing--pembroke" if district_code == 205 & election == "1988 Canadian federal election"
replace district_name = "restigouche" if district_code == 206 & election == "1988 Canadian federal election"
replace district_name = "richelieu" if district_code == 207 & election == "1988 Canadian federal election"
replace district_name = "richmond" if district_code == 208 & election == "1988 Canadian federal election"
replace district_name = "richmond--wolfe" if district_code == 209 & election == "1988 Canadian federal election"
replace district_name = "rimouski--témiscouata" if district_code == 210 & election == "1988 Canadian federal election"
replace district_name = "roberval" if district_code == 211 & election == "1988 Canadian federal election"
replace district_name = "rosedale" if district_code == 212 & election == "1988 Canadian federal election"
replace district_name = "rosemont" if district_code == 213 & election == "1988 Canadian federal election"
replace district_name = "saanich--gulf islands" if district_code == 214 & election == "1988 Canadian federal election"
replace district_name = "saint john" if district_code == 215 & election == "1988 Canadian federal election"
replace district_name = "saint-denis" if district_code == 216 & election == "1988 Canadian federal election"
replace district_name = "saint-henri--westmount" if district_code == 217 & election == "1988 Canadian federal election"
replace district_name = "saint-hubert" if district_code == 218 & election == "1988 Canadian federal election"
replace district_name = "saint-hyacinthe--bagot" if district_code == 219 & election == "1988 Canadian federal election"
replace district_name = "saint-jean" if district_code == 220 & election == "1988 Canadian federal election"
replace district_name = "saint-laurent" if district_code == 221 & election == "1988 Canadian federal election"
replace district_name = "saint-léonard" if district_code == 222 & election == "1988 Canadian federal election"
replace district_name = "saint-maurice" if district_code == 223 & election == "1988 Canadian federal election"
replace district_name = "sarnia--lambton" if district_code == 224 & election == "1988 Canadian federal election"
replace district_name = "saskatoon--clark's crossing" if district_code == 225 & election == "1988 Canadian federal election"
replace district_name = "saskatoon--dundurn" if district_code == 226 & election == "1988 Canadian federal election"
replace district_name = "saskatoon--humboldt" if district_code == 227 & election == "1988 Canadian federal election"
replace district_name = "sault ste. marie" if district_code == 228 & election == "1988 Canadian federal election"
replace district_name = "scarborough centre" if district_code == 229 & election == "1988 Canadian federal election"
replace district_name = "scarborough east" if district_code == 230 & election == "1988 Canadian federal election"
replace district_name = "scarborough west" if district_code == 231 & election == "1988 Canadian federal election"
replace district_name = "scarborough--agincourt" if district_code == 232 & election == "1988 Canadian federal election"
replace district_name = "scarborough--rouge river" if district_code == 233 & election == "1988 Canadian federal election"
replace district_name = "selkirk" if district_code == 234 & election == "1988 Canadian federal election"
replace district_name = "shefford" if district_code == 235 & election == "1988 Canadian federal election"
replace district_name = "sherbrooke" if district_code == 236 & election == "1988 Canadian federal election"
replace district_name = "simcoe centre" if district_code == 237 & election == "1988 Canadian federal election"
replace district_name = "simcoe north" if district_code == 238 & election == "1988 Canadian federal election"
replace district_name = "skeena" if district_code == 239 & election == "1988 Canadian federal election"
replace district_name = "souris--moose mountain" if district_code == 240 & election == "1988 Canadian federal election"
replace district_name = "south shore" if district_code == 241 & election == "1988 Canadian federal election"
replace district_name = "south west nova" if district_code == 242 & election == "1988 Canadian federal election"
replace district_name = "st. albert" if district_code == 243 & election == "1988 Canadian federal election"
replace district_name = "st. boniface" if district_code == 244 & election == "1988 Canadian federal election"
replace district_name = "st. catharines" if district_code == 245 & election == "1988 Canadian federal election"
replace district_name = "st. john's east" if district_code == 246 & election == "1988 Canadian federal election"
replace district_name = "st. john's west" if district_code == 247 & election == "1988 Canadian federal election"
replace district_name = "st. paul's" if district_code == 248 & election == "1988 Canadian federal election"
replace district_name = "stormont--dundas" if district_code == 249 & election == "1988 Canadian federal election"
replace district_name = "sudbury" if district_code == 250 & election == "1988 Canadian federal election"
replace district_name = "surrey north" if district_code == 251 & election == "1988 Canadian federal election"
replace district_name = "surrey--white rock" if district_code == 252 & election == "1988 Canadian federal election"
replace district_name = "swift current--maple creek--assiniboia" if district_code == 253 & election == "1988 Canadian federal election"
replace district_name = "terrebonne" if district_code == 254 & election == "1988 Canadian federal election"
replace district_name = "the battlefords--meadow lake" if district_code == 255 & election == "1988 Canadian federal election"
replace district_name = "thunder bay--atikokan" if district_code == 256 & election == "1988 Canadian federal election"
replace district_name = "thunder bay--nipigon" if district_code == 257 & election == "1988 Canadian federal election"
replace district_name = "timiskaming" if district_code == 258 & election == "1988 Canadian federal election"
replace district_name = "timmins--chapleau" if district_code == 259 & election == "1988 Canadian federal election"
replace district_name = "trinity--spadina" if district_code == 260 & election == "1988 Canadian federal election"
replace district_name = "trois-rivières" if district_code == 261 & election == "1988 Canadian federal election"
replace district_name = "témiscamingue" if district_code == 262 & election == "1988 Canadian federal election"
replace district_name = "vancouver centre" if district_code == 263 & election == "1988 Canadian federal election"
replace district_name = "vancouver east" if district_code == 264 & election == "1988 Canadian federal election"
replace district_name = "vancouver quadra" if district_code == 265 & election == "1988 Canadian federal election"
replace district_name = "vancouver south" if district_code == 266 & election == "1988 Canadian federal election"
replace district_name = "vaudreuil" if district_code == 267 & election == "1988 Canadian federal election"
replace district_name = "vegreville" if district_code == 268 & election == "1988 Canadian federal election"
replace district_name = "verchères" if district_code == 269 & election == "1988 Canadian federal election"
replace district_name = "verdun--saint-paul" if district_code == 270 & election == "1988 Canadian federal election"
replace district_name = "victoria" if district_code == 271 & election == "1988 Canadian federal election"
replace district_name = "victoria--haliburton" if district_code == 272 & election == "1988 Canadian federal election"
replace district_name = "waterloo" if district_code == 273 & election == "1988 Canadian federal election"
replace district_name = "welland--st. catharines--thorold" if district_code == 274 & election == "1988 Canadian federal election"
replace district_name = "wellington--grey--dufferin--simcoe" if district_code == 275 & election == "1988 Canadian federal election"
replace district_name = "western arctic" if district_code == 276 & election == "1988 Canadian federal election"
replace district_name = "wetaskiwin" if district_code == 277 & election == "1988 Canadian federal election"
replace district_name = "wild rose" if district_code == 278 & election == "1988 Canadian federal election"
replace district_name = "willowdale" if district_code == 279 & election == "1988 Canadian federal election"
replace district_name = "windsor west" if district_code == 280 & election == "1988 Canadian federal election"
replace district_name = "windsor--lake st. clair" if district_code == 281 & election == "1988 Canadian federal election"
replace district_name = "winnipeg north" if district_code == 282 & election == "1988 Canadian federal election"
replace district_name = "winnipeg north centre" if district_code == 283 & election == "1988 Canadian federal election"
replace district_name = "winnipeg south/winnipeg-sud" if district_code == 284 & election == "1988 Canadian federal election"
replace district_name = "winnipeg south centre/winnipeg-centre-sud" if district_code == 285 & election == "1988 Canadian federal election"
replace district_name = "winnipeg transcona" if district_code == 286 & election == "1988 Canadian federal election"
replace district_name = "winnipeg--st. james" if district_code == 287 & election == "1988 Canadian federal election"
replace district_name = "yellowhead" if district_code == 288 & election == "1988 Canadian federal election"
replace district_name = "york centre" if district_code == 289 & election == "1988 Canadian federal election"
replace district_name = "york north" if district_code == 290 & election == "1988 Canadian federal election"
replace district_name = "york south--weston" if district_code == 291 & election == "1988 Canadian federal election"
replace district_name = "york west" if district_code == 292 & election == "1988 Canadian federal election"
replace district_name = "york--simcoe" if district_code == 293 & election == "1988 Canadian federal election"
replace district_name = "yorkton--melville" if district_code == 294 & election == "1988 Canadian federal election"
replace district_name = "yukon" if district_code == 295 & election == "1988 Canadian federal election"
replace district_name = "Flensburg - Schleswig" if district_code == 1 & election == "2009 German federal election"
replace district_name = "Nordfriesland - Dithmarschen Nord" if district_code == 2 & election == "2009 German federal election"
replace district_name = "Steinburg - Dithmarschen Süd" if district_code == 3 & election == "2009 German federal election"
replace district_name = "Rendsburg-Eckernförde" if district_code == 4 & election == "2009 German federal election"
replace district_name = "Kiel" if district_code == 5 & election == "2009 German federal election"
replace district_name = "Plön - Neumünster" if district_code == 6 & election == "2009 German federal election"
replace district_name = "Pinneberg" if district_code == 7 & election == "2009 German federal election"
replace district_name = "Segeberg - Stormarn-Nord" if district_code == 8 & election == "2009 German federal election"
replace district_name = "Ostholstein" if district_code == 9 & election == "2009 German federal election"
replace district_name = "Herzogtum Lauenburg - Stormarn-Süd" if district_code == 10 & election == "2009 German federal election"
replace district_name = "Lübeck" if district_code == 11 & election == "2009 German federal election"
replace district_name = "Wismar - Nordwestmecklenburg - Parchim" if district_code == 12 & election == "2009 German federal election"
replace district_name = "Schwerin - Ludwigslust" if district_code == 13 & election == "2009 German federal election"
replace district_name = "Rostock" if district_code == 14 & election == "2009 German federal election"
replace district_name = "Stralsund - Nordvorpommern - Rügen" if district_code == 15 & election == "2009 German federal election"
replace district_name = "Greifswald - Demmin - Ostvorpommern" if district_code == 16 & election == "2009 German federal election"
replace district_name = "Bad Doberan - Güstrow - Müritz" if district_code == 17 & election == "2009 German federal election"
replace district_name = "Neubrandenburg - Mecklenburg-Strelitz - Uecker-Randow" if district_code == 18 & election == "2009 German federal election"
replace district_name = "Hamburg-Mitte" if district_code == 19 & election == "2009 German federal election"
replace district_name = "Hamburg-Altona" if district_code == 20 & election == "2009 German federal election"
replace district_name = "Hamburg-Eimsbüttel" if district_code == 21 & election == "2009 German federal election"
replace district_name = "Hamburg-Nord" if district_code == 22 & election == "2009 German federal election"
replace district_name = "Hamburg-Wandsbek" if district_code == 23 & election == "2009 German federal election"
replace district_name = "Hamburg-Bergedorf - Harburg" if district_code == 24 & election == "2009 German federal election"
replace district_name = "Aurich - Emden" if district_code == 25 & election == "2009 German federal election"
replace district_name = "Unterems" if district_code == 26 & election == "2009 German federal election"
replace district_name = "Friesland - Wilhelmshaven" if district_code == 27 & election == "2009 German federal election"
replace district_name = "Oldenburg - Ammerland" if district_code == 28 & election == "2009 German federal election"
replace district_name = "Delmenhorst - Wesermarsch - Oldenburg-Land" if district_code == 29 & election == "2009 German federal election"
replace district_name = "Cuxhaven - Stade II" if district_code == 30 & election == "2009 German federal election"
replace district_name = "Stade I - Rotenburg II" if district_code == 31 & election == "2009 German federal election"
replace district_name = "Mittelems" if district_code == 32 & election == "2009 German federal election"
replace district_name = "Cloppenburg - Vechta" if district_code == 33 & election == "2009 German federal election"
replace district_name = "Diepholz - Nienburg I" if district_code == 34 & election == "2009 German federal election"
replace district_name = "Osterholz - Verden" if district_code == 35 & election == "2009 German federal election"
replace district_name = "Rotenburg I - Soltau-Fallingbostel" if district_code == 36 & election == "2009 German federal election"
replace district_name = "Harburg" if district_code == 37 & election == "2009 German federal election"
replace district_name = "Lüchow-Dannenberg - Lüneburg" if district_code == 38 & election == "2009 German federal election"
replace district_name = "Osnabrück-Land" if district_code == 39 & election == "2009 German federal election"
replace district_name = "Stadt Osnabrück" if district_code == 40 & election == "2009 German federal election"
replace district_name = "Nienburg II - Schaumburg" if district_code == 41 & election == "2009 German federal election"
replace district_name = "Stadt Hannover I" if district_code == 42 & election == "2009 German federal election"
replace district_name = "Stadt Hannover II" if district_code == 43 & election == "2009 German federal election"
replace district_name = "Hannover-Land I" if district_code == 44 & election == "2009 German federal election"
replace district_name = "Celle - Uelzen" if district_code == 45 & election == "2009 German federal election"
replace district_name = "Gifhorn - Peine" if district_code == 46 & election == "2009 German federal election"
replace district_name = "Hameln-Pyrmont - Holzminden" if district_code == 47 & election == "2009 German federal election"
replace district_name = "Hannover-Land II" if district_code == 48 & election == "2009 German federal election"
replace district_name = "Hildesheim" if district_code == 49 & election == "2009 German federal election"
replace district_name = "Salzgitter - Wolfenbüttel" if district_code == 50 & election == "2009 German federal election"
replace district_name = "Braunschweig" if district_code == 51 & election == "2009 German federal election"
replace district_name = "Helmstedt - Wolfsburg" if district_code == 52 & election == "2009 German federal election"
replace district_name = "Goslar - Northeim - Osterode" if district_code == 53 & election == "2009 German federal election"
replace district_name = "Göttingen" if district_code == 54 & election == "2009 German federal election"
replace district_name = "Bremen I" if district_code == 55 & election == "2009 German federal election"
replace district_name = "Bremen II - Bremerhaven" if district_code == 56 & election == "2009 German federal election"
replace district_name = "Prignitz - Ostprignitz-Ruppin - Havelland I" if district_code == 57 & election == "2009 German federal election"
replace district_name = "Uckermark - Barnim I" if district_code == 58 & election == "2009 German federal election"
replace district_name = "Oberhavel - Havelland II" if district_code == 59 & election == "2009 German federal election"
replace district_name = "Märkisch-Oderland - Barnim II" if district_code == 60 & election == "2009 German federal election"
replace district_name = "Brandenburg an der Havel - Potsdam-Mittelmark I - Havelland III - Teltow-Fläming I" if district_code == 61 & election == "2009 German federal election"
replace district_name = "Potsdam - Potsdam-Mittelmark II - Teltow-Fläming II" if district_code == 62 & election == "2009 German federal election"
replace district_name = "Dahme-Spreewald - Teltow-Fläming III - Oberspreewald-Lausitz I" if district_code == 63 & election == "2009 German federal election"
replace district_name = "Frankfurt (Oder) - Oder-Spree" if district_code == 64 & election == "2009 German federal election"
replace district_name = "Cottbus - Spree-Neiße" if district_code == 65 & election == "2009 German federal election"
replace district_name = "Elbe-Elster - Oberspreewald-Lausitz II" if district_code == 66 & election == "2009 German federal election"
replace district_name = "Altmark" if district_code == 67 & election == "2009 German federal election"
replace district_name = "Börde - Jerichower Land" if district_code == 68 & election == "2009 German federal election"
replace district_name = "Harz" if district_code == 69 & election == "2009 German federal election"
replace district_name = "Magdeburg" if district_code == 70 & election == "2009 German federal election"
replace district_name = "Dessau - Wittenberg" if district_code == 71 & election == "2009 German federal election"
replace district_name = "Anhalt" if district_code == 72 & election == "2009 German federal election"
replace district_name = "Halle" if district_code == 73 & election == "2009 German federal election"
replace district_name = "Burgenland - Saalekreis" if district_code == 74 & election == "2009 German federal election"
replace district_name = "Mansfeld" if district_code == 75 & election == "2009 German federal election"
replace district_name = "Berlin-Mitte" if district_code == 76 & election == "2009 German federal election"
replace district_name = "Berlin-Pankow" if district_code == 77 & election == "2009 German federal election"
replace district_name = "Berlin-Reinickendorf" if district_code == 78 & election == "2009 German federal election"
replace district_name = "Berlin-Spandau - Charlottenburg Nord" if district_code == 79 & election == "2009 German federal election"
replace district_name = "Berlin-Steglitz - Zehlendorf" if district_code == 80 & election == "2009 German federal election"
replace district_name = "Berlin-Charlottenburg - Wilmersdorf" if district_code == 81 & election == "2009 German federal election"
replace district_name = "Berlin-Tempelhof - Schöneberg" if district_code == 82 & election == "2009 German federal election"
replace district_name = "Berlin-Neukölln" if district_code == 83 & election == "2009 German federal election"
replace district_name = "Berlin-Friedrichshain - Kreuzberg - Prenzlauer Berg Ost" if district_code == 84 & election == "2009 German federal election"
replace district_name = "Berlin-Treptow - Köpenick" if district_code == 85 & election == "2009 German federal election"
replace district_name = "Berlin-Marzahn - Hellersdorf" if district_code == 86 & election == "2009 German federal election"
replace district_name = "Berlin-Lichtenberg" if district_code == 87 & election == "2009 German federal election"
replace district_name = "Aachen" if district_code == 88 & election == "2009 German federal election"
replace district_name = "Kreis Aachen" if district_code == 89 & election == "2009 German federal election"
replace district_name = "Heinsberg" if district_code == 90 & election == "2009 German federal election"
replace district_name = "Düren" if district_code == 91 & election == "2009 German federal election"
replace district_name = "Erftkreis I" if district_code == 92 & election == "2009 German federal election"
replace district_name = "Euskirchen - Erftkreis II" if district_code == 93 & election == "2009 German federal election"
replace district_name = "Köln I" if district_code == 94 & election == "2009 German federal election"
replace district_name = "Köln II" if district_code == 95 & election == "2009 German federal election"
replace district_name = "Köln III" if district_code == 96 & election == "2009 German federal election"
replace district_name = "Bonn" if district_code == 97 & election == "2009 German federal election"
replace district_name = "Rhein-Sieg-Kreis I" if district_code == 98 & election == "2009 German federal election"
replace district_name = "Rhein-Sieg-Kreis II" if district_code == 99 & election == "2009 German federal election"
replace district_name = "Oberbergischer Kreis" if district_code == 100 & election == "2009 German federal election"
replace district_name = "Rheinisch-Bergischer Kreis" if district_code == 101 & election == "2009 German federal election"
replace district_name = "Leverkusen - Köln IV" if district_code == 102 & election == "2009 German federal election"
replace district_name = "Wuppertal I" if district_code == 103 & election == "2009 German federal election"
replace district_name = "Solingen - Remscheid - Wuppertal II" if district_code == 104 & election == "2009 German federal election"
replace district_name = "Mettmann I" if district_code == 105 & election == "2009 German federal election"
replace district_name = "Mettmann II" if district_code == 106 & election == "2009 German federal election"
replace district_name = "Düsseldorf I" if district_code == 107 & election == "2009 German federal election"
replace district_name = "Düsseldorf II" if district_code == 108 & election == "2009 German federal election"
replace district_name = "Neuss I" if district_code == 109 & election == "2009 German federal election"
replace district_name = "Mönchengladbach" if district_code == 110 & election == "2009 German federal election"
replace district_name = "Krefeld I - Neuss II" if district_code == 111 & election == "2009 German federal election"
replace district_name = "Viersen" if district_code == 112 & election == "2009 German federal election"
replace district_name = "Kleve" if district_code == 113 & election == "2009 German federal election"
replace district_name = "Wesel I" if district_code == 114 & election == "2009 German federal election"
replace district_name = "Krefeld II - Wesel II" if district_code == 115 & election == "2009 German federal election"
replace district_name = "Duisburg I" if district_code == 116 & election == "2009 German federal election"
replace district_name = "Duisburg II" if district_code == 117 & election == "2009 German federal election"
replace district_name = "Oberhausen - Wesel III" if district_code == 118 & election == "2009 German federal election"
replace district_name = "Mülheim - Essen I" if district_code == 119 & election == "2009 German federal election"
replace district_name = "Essen II" if district_code == 120 & election == "2009 German federal election"
replace district_name = "Essen III" if district_code == 121 & election == "2009 German federal election"
replace district_name = "Recklinghausen I" if district_code == 122 & election == "2009 German federal election"
replace district_name = "Recklinghausen II" if district_code == 123 & election == "2009 German federal election"
replace district_name = "Gelsenkirchen" if district_code == 124 & election == "2009 German federal election"
replace district_name = "Steinfurt I - Borken I" if district_code == 125 & election == "2009 German federal election"
replace district_name = "Bottrop - Recklinghausen III" if district_code == 126 & election == "2009 German federal election"
replace district_name = "Borken II" if district_code == 127 & election == "2009 German federal election"
replace district_name = "Coesfeld - Steinfurt II" if district_code == 128 & election == "2009 German federal election"
replace district_name = "Steinfurt III" if district_code == 129 & election == "2009 German federal election"
replace district_name = "Münster" if district_code == 130 & election == "2009 German federal election"
replace district_name = "Warendorf" if district_code == 131 & election == "2009 German federal election"
replace district_name = "Gütersloh" if district_code == 132 & election == "2009 German federal election"
replace district_name = "Bielefeld" if district_code == 133 & election == "2009 German federal election"
replace district_name = "Herford - Minden-Lübbecke II" if district_code == 134 & election == "2009 German federal election"
replace district_name = "Minden-Lübbecke I" if district_code == 135 & election == "2009 German federal election"
replace district_name = "Lippe I" if district_code == 136 & election == "2009 German federal election"
replace district_name = "Höxter - Lippe II" if district_code == 137 & election == "2009 German federal election"
replace district_name = "Paderborn" if district_code == 138 & election == "2009 German federal election"
replace district_name = "Hagen - Ennepe-Ruhr-Kreis I" if district_code == 139 & election == "2009 German federal election"
replace district_name = "Ennepe-Ruhr-Kreis II" if district_code == 140 & election == "2009 German federal election"
replace district_name = "Bochum I" if district_code == 141 & election == "2009 German federal election"
replace district_name = "Herne - Bochum II" if district_code == 142 & election == "2009 German federal election"
replace district_name = "Dortmund I" if district_code == 143 & election == "2009 German federal election"
replace district_name = "Dortmund II" if district_code == 144 & election == "2009 German federal election"
replace district_name = "Unna I" if district_code == 145 & election == "2009 German federal election"
replace district_name = "Hamm - Unna II" if district_code == 146 & election == "2009 German federal election"
replace district_name = "Soest" if district_code == 147 & election == "2009 German federal election"
replace district_name = "Hochsauerlandkreis" if district_code == 148 & election == "2009 German federal election"
replace district_name = "Siegen-Wittgenstein" if district_code == 149 & election == "2009 German federal election"
replace district_name = "Olpe - Märkischer Kreis I" if district_code == 150 & election == "2009 German federal election"
replace district_name = "Märkischer Kreis II" if district_code == 151 & election == "2009 German federal election"
replace district_name = "Nordsachsen" if district_code == 152 & election == "2009 German federal election"
replace district_name = "Leipzig I" if district_code == 153 & election == "2009 German federal election"
replace district_name = "Leipzig II" if district_code == 154 & election == "2009 German federal election"
replace district_name = "Leipzig-Land" if district_code == 155 & election == "2009 German federal election"
replace district_name = "Meißen" if district_code == 156 & election == "2009 German federal election"
replace district_name = "Bautzen I" if district_code == 157 & election == "2009 German federal election"
replace district_name = "Görlitz" if district_code == 158 & election == "2009 German federal election"
replace district_name = "Sächsische Schweiz - Osterzgebirge" if district_code == 159 & election == "2009 German federal election"
replace district_name = "Dresden I" if district_code == 160 & election == "2009 German federal election"
replace district_name = "Dresden II - Bautzen II" if district_code == 161 & election == "2009 German federal election"
replace district_name = "Mittelsachsen" if district_code == 162 & election == "2009 German federal election"
replace district_name = "Chemnitz" if district_code == 163 & election == "2009 German federal election"
replace district_name = "Chemnitzer Umland - Erzgebirgskreis II" if district_code == 164 & election == "2009 German federal election"
replace district_name = "Erzgebirgskreis I" if district_code == 165 & election == "2009 German federal election"
replace district_name = "Zwickau" if district_code == 166 & election == "2009 German federal election"
replace district_name = "Vogtlandkreis" if district_code == 167 & election == "2009 German federal election"
replace district_name = "Waldeck" if district_code == 168 & election == "2009 German federal election"
replace district_name = "Kassel" if district_code == 169 & election == "2009 German federal election"
replace district_name = "Werra-Meißner - Hersfeld-Rotenburg" if district_code == 170 & election == "2009 German federal election"
replace district_name = "Schwalm-Eder" if district_code == 171 & election == "2009 German federal election"
replace district_name = "Marburg" if district_code == 172 & election == "2009 German federal election"
replace district_name = "Lahn-Dill" if district_code == 173 & election == "2009 German federal election"
replace district_name = "Gießen" if district_code == 174 & election == "2009 German federal election"
replace district_name = "Fulda" if district_code == 175 & election == "2009 German federal election"
replace district_name = "Hochtaunus" if district_code == 176 & election == "2009 German federal election"
replace district_name = "Wetterau" if district_code == 177 & election == "2009 German federal election"
replace district_name = "Rheingau-Taunus - Limburg" if district_code == 178 & election == "2009 German federal election"
replace district_name = "Wiesbaden" if district_code == 179 & election == "2009 German federal election"
replace district_name = "Hanau" if district_code == 180 & election == "2009 German federal election"
replace district_name = "Main-Taunus" if district_code == 181 & election == "2009 German federal election"
replace district_name = "Frankfurt am Main I" if district_code == 182 & election == "2009 German federal election"
replace district_name = "Frankfurt am Main II" if district_code == 183 & election == "2009 German federal election"
replace district_name = "Groß-Gerau" if district_code == 184 & election == "2009 German federal election"
replace district_name = "Offenbach" if district_code == 185 & election == "2009 German federal election"
replace district_name = "Darmstadt" if district_code == 186 & election == "2009 German federal election"
replace district_name = "Odenwald" if district_code == 187 & election == "2009 German federal election"
replace district_name = "Bergstraße" if district_code == 188 & election == "2009 German federal election"
replace district_name = "Eichsfeld - Nordhausen - Unstrut-Hainich-Kreis I" if district_code == 189 & election == "2009 German federal election"
replace district_name = "Eisenach - Wartburgkreis - Unstrut-Hainich-Kreis II" if district_code == 190 & election == "2009 German federal election"
replace district_name = "Kyffhäuserkreis - Sömmerda - Weimarer Land I" if district_code == 191 & election == "2009 German federal election"
replace district_name = "Gotha - Ilm-Kreis" if district_code == 192 & election == "2009 German federal election"
replace district_name = "Erfurt - Weimar - Weimarer Land II" if district_code == 193 & election == "2009 German federal election"
replace district_name = "Gera - Jena - Saale-Holzland-Kreis" if district_code == 194 & election == "2009 German federal election"
replace district_name = "Greiz - Altenburger Land" if district_code == 195 & election == "2009 German federal election"
replace district_name = "Sonneberg - Saalfeld-Rudolstadt - Saale-Orla-Kreis" if district_code == 196 & election == "2009 German federal election"
replace district_name = "Suhl - Schmalkalden-Meiningen - Hildburghausen" if district_code == 197 & election == "2009 German federal election"
replace district_name = "Neuwied" if district_code == 198 & election == "2009 German federal election"
replace district_name = "Ahrweiler" if district_code == 199 & election == "2009 German federal election"
replace district_name = "Koblenz" if district_code == 200 & election == "2009 German federal election"
replace district_name = "Mosel/Rhein-Hunsrück" if district_code == 201 & election == "2009 German federal election"
replace district_name = "Kreuznach" if district_code == 202 & election == "2009 German federal election"
replace district_name = "Bitburg" if district_code == 203 & election == "2009 German federal election"
replace district_name = "Trier" if district_code == 204 & election == "2009 German federal election"
replace district_name = "Montabaur" if district_code == 205 & election == "2009 German federal election"
replace district_name = "Mainz" if district_code == 206 & election == "2009 German federal election"
replace district_name = "Worms" if district_code == 207 & election == "2009 German federal election"
replace district_name = "Ludwigshafen/Frankenthal" if district_code == 208 & election == "2009 German federal election"
replace district_name = "Neustadt - Speyer" if district_code == 209 & election == "2009 German federal election"
replace district_name = "Kaiserslautern" if district_code == 210 & election == "2009 German federal election"
replace district_name = "Pirmasens" if district_code == 211 & election == "2009 German federal election"
replace district_name = "Südpfalz" if district_code == 212 & election == "2009 German federal election"
replace district_name = "Altötting" if district_code == 213 & election == "2009 German federal election"
replace district_name = "Erding - Ebersberg" if district_code == 214 & election == "2009 German federal election"
replace district_name = "Freising" if district_code == 215 & election == "2009 German federal election"
replace district_name = "Fürstenfeldbruck" if district_code == 216 & election == "2009 German federal election"
replace district_name = "Ingolstadt" if district_code == 217 & election == "2009 German federal election"
replace district_name = "München-Nord" if district_code == 218 & election == "2009 German federal election"
replace district_name = "München-Ost" if district_code == 219 & election == "2009 German federal election"
replace district_name = "München-Süd" if district_code == 220 & election == "2009 German federal election"
replace district_name = "München-West/Mitte" if district_code == 221 & election == "2009 German federal election"
replace district_name = "München-Land" if district_code == 222 & election == "2009 German federal election"
replace district_name = "Rosenheim" if district_code == 223 & election == "2009 German federal election"
replace district_name = "Starnberg" if district_code == 224 & election == "2009 German federal election"
replace district_name = "Traunstein" if district_code == 225 & election == "2009 German federal election"
replace district_name = "Weilheim" if district_code == 226 & election == "2009 German federal election"
replace district_name = "Deggendorf" if district_code == 227 & election == "2009 German federal election"
replace district_name = "Landshut" if district_code == 228 & election == "2009 German federal election"
replace district_name = "Passau" if district_code == 229 & election == "2009 German federal election"
replace district_name = "Rottal-Inn" if district_code == 230 & election == "2009 German federal election"
replace district_name = "Straubing" if district_code == 231 & election == "2009 German federal election"
replace district_name = "Amberg" if district_code == 232 & election == "2009 German federal election"
replace district_name = "Regensburg" if district_code == 233 & election == "2009 German federal election"
replace district_name = "Schwandorf" if district_code == 234 & election == "2009 German federal election"
replace district_name = "Weiden" if district_code == 235 & election == "2009 German federal election"
replace district_name = "Bamberg" if district_code == 236 & election == "2009 German federal election"
replace district_name = "Bayreuth" if district_code == 237 & election == "2009 German federal election"
replace district_name = "Coburg" if district_code == 238 & election == "2009 German federal election"
replace district_name = "Hof" if district_code == 239 & election == "2009 German federal election"
replace district_name = "Kulmbach" if district_code == 240 & election == "2009 German federal election"
replace district_name = "Ansbach" if district_code == 241 & election == "2009 German federal election"
replace district_name = "Erlangen" if district_code == 242 & election == "2009 German federal election"
replace district_name = "Fürth" if district_code == 243 & election == "2009 German federal election"
replace district_name = "Nürnberg-Nord" if district_code == 244 & election == "2009 German federal election"
replace district_name = "Nürnberg-Süd" if district_code == 245 & election == "2009 German federal election"
replace district_name = "Roth" if district_code == 246 & election == "2009 German federal election"
replace district_name = "Aschaffenburg" if district_code == 247 & election == "2009 German federal election"
replace district_name = "Bad Kissingen" if district_code == 248 & election == "2009 German federal election"
replace district_name = "Main-Spessart" if district_code == 249 & election == "2009 German federal election"
replace district_name = "Schweinfurt" if district_code == 250 & election == "2009 German federal election"
replace district_name = "Würzburg" if district_code == 251 & election == "2009 German federal election"
replace district_name = "Augsburg-Stadt" if district_code == 252 & election == "2009 German federal election"
replace district_name = "Augsburg-Land" if district_code == 253 & election == "2009 German federal election"
replace district_name = "Donau-Ries" if district_code == 254 & election == "2009 German federal election"
replace district_name = "Neu-Ulm" if district_code == 255 & election == "2009 German federal election"
replace district_name = "Oberallgäu" if district_code == 256 & election == "2009 German federal election"
replace district_name = "Ostallgäu" if district_code == 257 & election == "2009 German federal election"
replace district_name = "Stuttgart I" if district_code == 258 & election == "2009 German federal election"
replace district_name = "Stuttgart II" if district_code == 259 & election == "2009 German federal election"
replace district_name = "Böblingen" if district_code == 260 & election == "2009 German federal election"
replace district_name = "Esslingen" if district_code == 261 & election == "2009 German federal election"
replace district_name = "Nürtingen" if district_code == 262 & election == "2009 German federal election"
replace district_name = "Göppingen" if district_code == 263 & election == "2009 German federal election"
replace district_name = "Waiblingen" if district_code == 264 & election == "2009 German federal election"
replace district_name = "Ludwigsburg" if district_code == 265 & election == "2009 German federal election"
replace district_name = "Neckar-Zaber" if district_code == 266 & election == "2009 German federal election"
replace district_name = "Heilbronn" if district_code == 267 & election == "2009 German federal election"
replace district_name = "Schwäbisch Hall - Hohenlohe" if district_code == 268 & election == "2009 German federal election"
replace district_name = "Backnang - Schwäbisch Gmünd" if district_code == 269 & election == "2009 German federal election"
replace district_name = "Aalen - Heidenheim" if district_code == 270 & election == "2009 German federal election"
replace district_name = "Karlsruhe-Stadt" if district_code == 271 & election == "2009 German federal election"
replace district_name = "Karlsruhe-Land" if district_code == 272 & election == "2009 German federal election"
replace district_name = "Rastatt" if district_code == 273 & election == "2009 German federal election"
replace district_name = "Heidelberg" if district_code == 274 & election == "2009 German federal election"
replace district_name = "Mannheim" if district_code == 275 & election == "2009 German federal election"
replace district_name = "Odenwald - Tauber" if district_code == 276 & election == "2009 German federal election"
replace district_name = "Rhein-Neckar" if district_code == 277 & election == "2009 German federal election"
replace district_name = "Bruchsal - Schwetzingen" if district_code == 278 & election == "2009 German federal election"
replace district_name = "Pforzheim" if district_code == 279 & election == "2009 German federal election"
replace district_name = "Calw" if district_code == 280 & election == "2009 German federal election"
replace district_name = "Freiburg" if district_code == 281 & election == "2009 German federal election"
replace district_name = "Lörrach - Müllheim" if district_code == 282 & election == "2009 German federal election"
replace district_name = "Emmendingen - Lahr" if district_code == 283 & election == "2009 German federal election"
replace district_name = "Offenburg" if district_code == 284 & election == "2009 German federal election"
replace district_name = "Rottweil - Tuttlingen" if district_code == 285 & election == "2009 German federal election"
replace district_name = "Schwarzwald-Baar" if district_code == 286 & election == "2009 German federal election"
replace district_name = "Konstanz" if district_code == 287 & election == "2009 German federal election"
replace district_name = "Waldshut" if district_code == 288 & election == "2009 German federal election"
replace district_name = "Reutlingen" if district_code == 289 & election == "2009 German federal election"
replace district_name = "Tübingen" if district_code == 290 & election == "2009 German federal election"
replace district_name = "Ulm" if district_code == 291 & election == "2009 German federal election"
replace district_name = "Biberach" if district_code == 292 & election == "2009 German federal election"
replace district_name = "Bodensee" if district_code == 293 & election == "2009 German federal election"
replace district_name = "Ravensburg" if district_code == 294 & election == "2009 German federal election"
replace district_name = "Zollernalb - Sigmaringen" if district_code == 295 & election == "2009 German federal election"
replace district_name = "Saarbrücken" if district_code == 296 & election == "2009 German federal election"
replace district_name = "Saarlouis" if district_code == 297 & election == "2009 German federal election"
replace district_name = "St. Wendel" if district_code == 298 & election == "2009 German federal election"
replace district_name = "Homburg" if district_code == 299 & election == "2009 German federal election"
replace district_name = "Flensburg - Schleswig" if district_code == 1 & election == "2013 German federal election"
replace district_name = "Nordfriesland - Dithmarschen Nord" if district_code == 2 & election == "2013 German federal election"
replace district_name = "Steinburg - Dithmarschen Süd" if district_code == 3 & election == "2013 German federal election"
replace district_name = "Rendsburg-Eckernförde" if district_code == 4 & election == "2013 German federal election"
replace district_name = "Kiel" if district_code == 5 & election == "2013 German federal election"
replace district_name = "Plön - Neumünster" if district_code == 6 & election == "2013 German federal election"
replace district_name = "Pinneberg" if district_code == 7 & election == "2013 German federal election"
replace district_name = "Segeberg - Stormarn-Mitte" if district_code == 8 & election == "2013 German federal election"
replace district_name = "Ostholstein - Stormarn-Nord" if district_code == 9 & election == "2013 German federal election"
replace district_name = "Herzogtum Lauenburg - Stormarn-Süd" if district_code == 10 & election == "2013 German federal election"
replace district_name = "Lübeck" if district_code == 11 & election == "2013 German federal election"
replace district_name = "Schwerin - Ludwigslust-Parchim I - Nordwestmecklenburg I" if district_code == 12 & election == "2013 German federal election"
replace district_name = "Ludwigslust-Parchim II - Nordwestmecklenburg II - Landkreis Rostock I" if district_code == 13 & election == "2013 German federal election"
replace district_name = "Rostock - Landkreis Rostock II" if district_code == 14 & election == "2013 German federal election"
replace district_name = "Vorpommern-Rügen - Vorpommern-Greifswald I" if district_code == 15 & election == "2013 German federal election"
replace district_name = "Mecklenburgische Seenplatte I - Vorpommern-Greifswald II" if district_code == 16 & election == "2013 German federal election"
replace district_name = "Mecklenburgische Seenplatte II - Landkreis Rostock III" if district_code == 17 & election == "2013 German federal election"
replace district_name = "Hamburg-Mitte" if district_code == 18 & election == "2013 German federal election"
replace district_name = "Hamburg-Altona" if district_code == 19 & election == "2013 German federal election"
replace district_name = "Hamburg-Eimsbüttel" if district_code == 20 & election == "2013 German federal election"
replace district_name = "Hamburg-Nord" if district_code == 21 & election == "2013 German federal election"
replace district_name = "Hamburg-Wandsbek" if district_code == 22 & election == "2013 German federal election"
replace district_name = "Hamburg-Bergedorf - Harburg" if district_code == 23 & election == "2013 German federal election"
replace district_name = "Aurich - Emden" if district_code == 24 & election == "2013 German federal election"
replace district_name = "Unterems" if district_code == 25 & election == "2013 German federal election"
replace district_name = "Friesland - Wilhelmshaven - Wittmund" if district_code == 26 & election == "2013 German federal election"
replace district_name = "Oldenburg - Ammerland" if district_code == 27 & election == "2013 German federal election"
replace district_name = "Delmenhorst - Wesermarsch - Oldenburg-Land" if district_code == 28 & election == "2013 German federal election"
replace district_name = "Cuxhaven - Stade II" if district_code == 29 & election == "2013 German federal election"
replace district_name = "Stade I - Rotenburg II" if district_code == 30 & election == "2013 German federal election"
replace district_name = "Mittelems" if district_code == 31 & election == "2013 German federal election"
replace district_name = "Cloppenburg - Vechta" if district_code == 32 & election == "2013 German federal election"
replace district_name = "Diepholz - Nienburg I" if district_code == 33 & election == "2013 German federal election"
replace district_name = "Osterholz - Verden" if district_code == 34 & election == "2013 German federal election"
replace district_name = "Rotenburg I - Heidekreis" if district_code == 35 & election == "2013 German federal election"
replace district_name = "Harburg" if district_code == 36 & election == "2013 German federal election"
replace district_name = "Lüchow-Dannenberg - Lüneburg" if district_code == 37 & election == "2013 German federal election"
replace district_name = "Osnabrück-Land" if district_code == 38 & election == "2013 German federal election"
replace district_name = "Stadt Osnabrück" if district_code == 39 & election == "2013 German federal election"
replace district_name = "Nienburg II - Schaumburg" if district_code == 40 & election == "2013 German federal election"
replace district_name = "Stadt Hannover I" if district_code == 41 & election == "2013 German federal election"
replace district_name = "Stadt Hannover II" if district_code == 42 & election == "2013 German federal election"
replace district_name = "Hannover-Land I" if district_code == 43 & election == "2013 German federal election"
replace district_name = "Celle - Uelzen" if district_code == 44 & election == "2013 German federal election"
replace district_name = "Gifhorn - Peine" if district_code == 45 & election == "2013 German federal election"
replace district_name = "Hameln-Pyrmont - Holzminden" if district_code == 46 & election == "2013 German federal election"
replace district_name = "Hannover-Land II" if district_code == 47 & election == "2013 German federal election"
replace district_name = "Hildesheim" if district_code == 48 & election == "2013 German federal election"
replace district_name = "Salzgitter - Wolfenbüttel" if district_code == 49 & election == "2013 German federal election"
replace district_name = "Braunschweig" if district_code == 50 & election == "2013 German federal election"
replace district_name = "Helmstedt - Wolfsburg" if district_code == 51 & election == "2013 German federal election"
replace district_name = "Goslar - Northeim - Osterode" if district_code == 52 & election == "2013 German federal election"
replace district_name = "Göttingen" if district_code == 53 & election == "2013 German federal election"
replace district_name = "Bremen I" if district_code == 54 & election == "2013 German federal election"
replace district_name = "Bremen II - Bremerhaven" if district_code == 55 & election == "2013 German federal election"
replace district_name = "Prignitz - Ostprignitz-Ruppin - Havelland I" if district_code == 56 & election == "2013 German federal election"
replace district_name = "Uckermark - Barnim I" if district_code == 57 & election == "2013 German federal election"
replace district_name = "Oberhavel - Havelland II" if district_code == 58 & election == "2013 German federal election"
replace district_name = "Märkisch-Oderland - Barnim II" if district_code == 59 & election == "2013 German federal election"
replace district_name = "Brandenburg an der Havel - Potsdam-Mittelmark I - Havelland III - Teltow-Fläming I" if district_code == 60 & election == "2013 German federal election"
replace district_name = "Potsdam - Potsdam-Mittelmark II - Teltow-Fläming II" if district_code == 61 & election == "2013 German federal election"
replace district_name = "Dahme-Spreewald - Teltow-Fläming III - Oberspreewald-Lausitz I" if district_code == 62 & election == "2013 German federal election"
replace district_name = "Frankfurt (Oder) - Oder-Spree" if district_code == 63 & election == "2013 German federal election"
replace district_name = "Cottbus - Spree-Neiße" if district_code == 64 & election == "2013 German federal election"
replace district_name = "Elbe-Elster - Oberspreewald-Lausitz II" if district_code == 65 & election == "2013 German federal election"
replace district_name = "Altmark" if district_code == 66 & election == "2013 German federal election"
replace district_name = "Börde - Jerichower Land" if district_code == 67 & election == "2013 German federal election"
replace district_name = "Harz" if district_code == 68 & election == "2013 German federal election"
replace district_name = "Magdeburg" if district_code == 69 & election == "2013 German federal election"
replace district_name = "Dessau - Wittenberg" if district_code == 70 & election == "2013 German federal election"
replace district_name = "Anhalt" if district_code == 71 & election == "2013 German federal election"
replace district_name = "Halle" if district_code == 72 & election == "2013 German federal election"
replace district_name = "Burgenland - Saalekreis" if district_code == 73 & election == "2013 German federal election"
replace district_name = "Mansfeld" if district_code == 74 & election == "2013 German federal election"
replace district_name = "Berlin-Mitte" if district_code == 75 & election == "2013 German federal election"
replace district_name = "Berlin-Pankow" if district_code == 76 & election == "2013 German federal election"
replace district_name = "Berlin-Reinickendorf" if district_code == 77 & election == "2013 German federal election"
replace district_name = "Berlin-Spandau - Charlottenburg Nord" if district_code == 78 & election == "2013 German federal election"
replace district_name = "Berlin-Steglitz - Zehlendorf" if district_code == 79 & election == "2013 German federal election"
replace district_name = "Berlin-Charlottenburg - Wilmersdorf" if district_code == 80 & election == "2013 German federal election"
replace district_name = "Berlin-Tempelhof - Schöneberg" if district_code == 81 & election == "2013 German federal election"
replace district_name = "Berlin-Neukölln" if district_code == 82 & election == "2013 German federal election"
replace district_name = "Berlin-Friedrichshain-Kreuzberg - Prenzlauer Berg Ost" if district_code == 83 & election == "2013 German federal election"
replace district_name = "Berlin-Treptow - Köpenick" if district_code == 84 & election == "2013 German federal election"
replace district_name = "Berlin-Marzahn - Hellersdorf" if district_code == 85 & election == "2013 German federal election"
replace district_name = "Berlin-Lichtenberg" if district_code == 86 & election == "2013 German federal election"
replace district_name = "Aachen I" if district_code == 87 & election == "2013 German federal election"
replace district_name = "Aachen II" if district_code == 88 & election == "2013 German federal election"
replace district_name = "Heinsberg" if district_code == 89 & election == "2013 German federal election"
replace district_name = "Düren" if district_code == 90 & election == "2013 German federal election"
replace district_name = "Rhein-Erft-Kreis I" if district_code == 91 & election == "2013 German federal election"
replace district_name = "Euskirchen - Rhein-Erft-Kreis II" if district_code == 92 & election == "2013 German federal election"
replace district_name = "Köln I" if district_code == 93 & election == "2013 German federal election"
replace district_name = "Köln II" if district_code == 94 & election == "2013 German federal election"
replace district_name = "Köln III" if district_code == 95 & election == "2013 German federal election"
replace district_name = "Bonn" if district_code == 96 & election == "2013 German federal election"
replace district_name = "Rhein-Sieg-Kreis I" if district_code == 97 & election == "2013 German federal election"
replace district_name = "Rhein-Sieg-Kreis II" if district_code == 98 & election == "2013 German federal election"
replace district_name = "Oberbergischer Kreis" if district_code == 99 & election == "2013 German federal election"
replace district_name = "Rheinisch-Bergischer Kreis" if district_code == 100 & election == "2013 German federal election"
replace district_name = "Leverkusen - Köln IV" if district_code == 101 & election == "2013 German federal election"
replace district_name = "Wuppertal I" if district_code == 102 & election == "2013 German federal election"
replace district_name = "Solingen - Remscheid - Wuppertal II" if district_code == 103 & election == "2013 German federal election"
replace district_name = "Mettmann I" if district_code == 104 & election == "2013 German federal election"
replace district_name = "Mettmann II" if district_code == 105 & election == "2013 German federal election"
replace district_name = "Düsseldorf I" if district_code == 106 & election == "2013 German federal election"
replace district_name = "Düsseldorf II" if district_code == 107 & election == "2013 German federal election"
replace district_name = "Neuss I" if district_code == 108 & election == "2013 German federal election"
replace district_name = "Mönchengladbach" if district_code == 109 & election == "2013 German federal election"
replace district_name = "Krefeld I - Neuss II" if district_code == 110 & election == "2013 German federal election"
replace district_name = "Viersen" if district_code == 111 & election == "2013 German federal election"
replace district_name = "Kleve" if district_code == 112 & election == "2013 German federal election"
replace district_name = "Wesel I" if district_code == 113 & election == "2013 German federal election"
replace district_name = "Krefeld II - Wesel II" if district_code == 114 & election == "2013 German federal election"
replace district_name = "Duisburg I" if district_code == 115 & election == "2013 German federal election"
replace district_name = "Duisburg II" if district_code == 116 & election == "2013 German federal election"
replace district_name = "Oberhausen - Wesel III" if district_code == 117 & election == "2013 German federal election"
replace district_name = "Mülheim - Essen I" if district_code == 118 & election == "2013 German federal election"
replace district_name = "Essen II" if district_code == 119 & election == "2013 German federal election"
replace district_name = "Essen III" if district_code == 120 & election == "2013 German federal election"
replace district_name = "Recklinghausen I" if district_code == 121 & election == "2013 German federal election"
replace district_name = "Recklinghausen II" if district_code == 122 & election == "2013 German federal election"
replace district_name = "Gelsenkirchen" if district_code == 123 & election == "2013 German federal election"
replace district_name = "Steinfurt I - Borken I" if district_code == 124 & election == "2013 German federal election"
replace district_name = "Bottrop - Recklinghausen III" if district_code == 125 & election == "2013 German federal election"
replace district_name = "Borken II" if district_code == 126 & election == "2013 German federal election"
replace district_name = "Coesfeld - Steinfurt II" if district_code == 127 & election == "2013 German federal election"
replace district_name = "Steinfurt III" if district_code == 128 & election == "2013 German federal election"
replace district_name = "Münster" if district_code == 129 & election == "2013 German federal election"
replace district_name = "Warendorf" if district_code == 130 & election == "2013 German federal election"
replace district_name = "Gütersloh I" if district_code == 131 & election == "2013 German federal election"
replace district_name = "Bielefeld - Gütersloh II" if district_code == 132 & election == "2013 German federal election"
replace district_name = "Herford - Minden-Lübbecke II" if district_code == 133 & election == "2013 German federal election"
replace district_name = "Minden-Lübbecke I" if district_code == 134 & election == "2013 German federal election"
replace district_name = "Lippe I" if district_code == 135 & election == "2013 German federal election"
replace district_name = "Höxter - Lippe II" if district_code == 136 & election == "2013 German federal election"
replace district_name = "Paderborn - Gütersloh III" if district_code == 137 & election == "2013 German federal election"
replace district_name = "Hagen - Ennepe-Ruhr-Kreis I" if district_code == 138 & election == "2013 German federal election"
replace district_name = "Ennepe-Ruhr-Kreis II" if district_code == 139 & election == "2013 German federal election"
replace district_name = "Bochum I" if district_code == 140 & election == "2013 German federal election"
replace district_name = "Herne - Bochum II" if district_code == 141 & election == "2013 German federal election"
replace district_name = "Dortmund I" if district_code == 142 & election == "2013 German federal election"
replace district_name = "Dortmund II" if district_code == 143 & election == "2013 German federal election"
replace district_name = "Unna I" if district_code == 144 & election == "2013 German federal election"
replace district_name = "Hamm - Unna II" if district_code == 145 & election == "2013 German federal election"
replace district_name = "Soest" if district_code == 146 & election == "2013 German federal election"
replace district_name = "Hochsauerlandkreis" if district_code == 147 & election == "2013 German federal election"
replace district_name = "Siegen-Wittgenstein" if district_code == 148 & election == "2013 German federal election"
replace district_name = "Olpe - Märkischer Kreis I" if district_code == 149 & election == "2013 German federal election"
replace district_name = "Märkischer Kreis II" if district_code == 150 & election == "2013 German federal election"
replace district_name = "Nordsachsen" if district_code == 151 & election == "2013 German federal election"
replace district_name = "Leipzig I" if district_code == 152 & election == "2013 German federal election"
replace district_name = "Leipzig II" if district_code == 153 & election == "2013 German federal election"
replace district_name = "Leipzig-Land" if district_code == 154 & election == "2013 German federal election"
replace district_name = "Meißen" if district_code == 155 & election == "2013 German federal election"
replace district_name = "Bautzen I" if district_code == 156 & election == "2013 German federal election"
replace district_name = "Görlitz" if district_code == 157 & election == "2013 German federal election"
replace district_name = "Sächsische Schweiz - Osterzgebirge" if district_code == 158 & election == "2013 German federal election"
replace district_name = "Dresden I" if district_code == 159 & election == "2013 German federal election"
replace district_name = "Dresden II - Bautzen II" if district_code == 160 & election == "2013 German federal election"
replace district_name = "Mittelsachsen" if district_code == 161 & election == "2013 German federal election"
replace district_name = "Chemnitz" if district_code == 162 & election == "2013 German federal election"
replace district_name = "Chemnitzer Umland - Erzgebirgskreis II" if district_code == 163 & election == "2013 German federal election"
replace district_name = "Erzgebirgskreis I" if district_code == 164 & election == "2013 German federal election"
replace district_name = "Zwickau" if district_code == 165 & election == "2013 German federal election"
replace district_name = "Vogtlandkreis" if district_code == 166 & election == "2013 German federal election"
replace district_name = "Waldeck" if district_code == 167 & election == "2013 German federal election"
replace district_name = "Kassel" if district_code == 168 & election == "2013 German federal election"
replace district_name = "Werra-Meißner - Hersfeld-Rotenburg" if district_code == 169 & election == "2013 German federal election"
replace district_name = "Schwalm-Eder" if district_code == 170 & election == "2013 German federal election"
replace district_name = "Marburg" if district_code == 171 & election == "2013 German federal election"
replace district_name = "Lahn-Dill" if district_code == 172 & election == "2013 German federal election"
replace district_name = "Gießen" if district_code == 173 & election == "2013 German federal election"
replace district_name = "Fulda" if district_code == 174 & election == "2013 German federal election"
replace district_name = "Main-Kinzig - Wetterau II - Schotten" if district_code == 175 & election == "2013 German federal election"
replace district_name = "Hochtaunus" if district_code == 176 & election == "2013 German federal election"
replace district_name = "Wetterau I" if district_code == 177 & election == "2013 German federal election"
replace district_name = "Rheingau-Taunus - Limburg" if district_code == 178 & election == "2013 German federal election"
replace district_name = "Wiesbaden" if district_code == 179 & election == "2013 German federal election"
replace district_name = "Hanau" if district_code == 180 & election == "2013 German federal election"
replace district_name = "Main-Taunus" if district_code == 181 & election == "2013 German federal election"
replace district_name = "Frankfurt am Main I" if district_code == 182 & election == "2013 German federal election"
replace district_name = "Frankfurt am Main II" if district_code == 183 & election == "2013 German federal election"
replace district_name = "Groß-Gerau" if district_code == 184 & election == "2013 German federal election"
replace district_name = "Offenbach" if district_code == 185 & election == "2013 German federal election"
replace district_name = "Darmstadt" if district_code == 186 & election == "2013 German federal election"
replace district_name = "Odenwald" if district_code == 187 & election == "2013 German federal election"
replace district_name = "Bergstraße" if district_code == 188 & election == "2013 German federal election"
replace district_name = "Eichsfeld - Nordhausen - Unstrut-Hainich-Kreis I" if district_code == 189 & election == "2013 German federal election"
replace district_name = "Eisenach - Wartburgkreis - Unstrut-Hainich-Kreis II" if district_code == 190 & election == "2013 German federal election"
replace district_name = "Kyffhäuserkreis - Sömmerda - Weimarer Land I" if district_code == 191 & election == "2013 German federal election"
replace district_name = "Gotha - Ilm-Kreis" if district_code == 192 & election == "2013 German federal election"
replace district_name = "Erfurt - Weimar - Weimarer Land II" if district_code == 193 & election == "2013 German federal election"
replace district_name = "Gera - Jena - Saale-Holzland-Kreis" if district_code == 194 & election == "2013 German federal election"
replace district_name = "Greiz - Altenburger Land" if district_code == 195 & election == "2013 German federal election"
replace district_name = "Sonneberg - Saalfeld-Rudolstadt - Saale-Orla-Kreis" if district_code == 196 & election == "2013 German federal election"
replace district_name = "Suhl - Schmalkalden-Meiningen - Hildburghausen" if district_code == 197 & election == "2013 German federal election"
replace district_name = "Neuwied" if district_code == 198 & election == "2013 German federal election"
replace district_name = "Ahrweiler" if district_code == 199 & election == "2013 German federal election"
replace district_name = "Koblenz" if district_code == 200 & election == "2013 German federal election"
replace district_name = "Mosel/Rhein-Hunsrück" if district_code == 201 & election == "2013 German federal election"
replace district_name = "Kreuznach" if district_code == 202 & election == "2013 German federal election"
replace district_name = "Bitburg" if district_code == 203 & election == "2013 German federal election"
replace district_name = "Trier" if district_code == 204 & election == "2013 German federal election"
replace district_name = "Montabaur" if district_code == 205 & election == "2013 German federal election"
replace district_name = "Mainz" if district_code == 206 & election == "2013 German federal election"
replace district_name = "Worms" if district_code == 207 & election == "2013 German federal election"
replace district_name = "Ludwigshafen/Frankenthal" if district_code == 208 & election == "2013 German federal election"
replace district_name = "Neustadt - Speyer" if district_code == 209 & election == "2013 German federal election"
replace district_name = "Kaiserslautern" if district_code == 210 & election == "2013 German federal election"
replace district_name = "Pirmasens" if district_code == 211 & election == "2013 German federal election"
replace district_name = "Südpfalz" if district_code == 212 & election == "2013 German federal election"
replace district_name = "Altötting" if district_code == 213 & election == "2013 German federal election"
replace district_name = "Erding - Ebersberg" if district_code == 214 & election == "2013 German federal election"
replace district_name = "Freising" if district_code == 215 & election == "2013 German federal election"
replace district_name = "Fürstenfeldbruck" if district_code == 216 & election == "2013 German federal election"
replace district_name = "Ingolstadt" if district_code == 217 & election == "2013 German federal election"
replace district_name = "München-Nord" if district_code == 218 & election == "2013 German federal election"
replace district_name = "München-Ost" if district_code == 219 & election == "2013 German federal election"
replace district_name = "München-Süd" if district_code == 220 & election == "2013 German federal election"
replace district_name = "München-West/Mitte" if district_code == 221 & election == "2013 German federal election"
replace district_name = "München-Land" if district_code == 222 & election == "2013 German federal election"
replace district_name = "Rosenheim" if district_code == 223 & election == "2013 German federal election"
replace district_name = "Starnberg" if district_code == 224 & election == "2013 German federal election"
replace district_name = "Traunstein" if district_code == 225 & election == "2013 German federal election"
replace district_name = "Weilheim" if district_code == 226 & election == "2013 German federal election"
replace district_name = "Deggendorf" if district_code == 227 & election == "2013 German federal election"
replace district_name = "Landshut" if district_code == 228 & election == "2013 German federal election"
replace district_name = "Passau" if district_code == 229 & election == "2013 German federal election"
replace district_name = "Rottal-Inn" if district_code == 230 & election == "2013 German federal election"
replace district_name = "Straubing" if district_code == 231 & election == "2013 German federal election"
replace district_name = "Amberg" if district_code == 232 & election == "2013 German federal election"
replace district_name = "Regensburg" if district_code == 233 & election == "2013 German federal election"
replace district_name = "Schwandorf" if district_code == 234 & election == "2013 German federal election"
replace district_name = "Weiden" if district_code == 235 & election == "2013 German federal election"
replace district_name = "Bamberg" if district_code == 236 & election == "2013 German federal election"
replace district_name = "Bayreuth" if district_code == 237 & election == "2013 German federal election"
replace district_name = "Coburg" if district_code == 238 & election == "2013 German federal election"
replace district_name = "Hof" if district_code == 239 & election == "2013 German federal election"
replace district_name = "Kulmbach" if district_code == 240 & election == "2013 German federal election"
replace district_name = "Ansbach" if district_code == 241 & election == "2013 German federal election"
replace district_name = "Erlangen" if district_code == 242 & election == "2013 German federal election"
replace district_name = "Fürth" if district_code == 243 & election == "2013 German federal election"
replace district_name = "Nürnberg-Nord" if district_code == 244 & election == "2013 German federal election"
replace district_name = "Nürnberg-Süd" if district_code == 245 & election == "2013 German federal election"
replace district_name = "Roth" if district_code == 246 & election == "2013 German federal election"
replace district_name = "Aschaffenburg" if district_code == 247 & election == "2013 German federal election"
replace district_name = "Bad Kissingen" if district_code == 248 & election == "2013 German federal election"
replace district_name = "Main-Spessart" if district_code == 249 & election == "2013 German federal election"
replace district_name = "Schweinfurt" if district_code == 250 & election == "2013 German federal election"
replace district_name = "Würzburg" if district_code == 251 & election == "2013 German federal election"
replace district_name = "Augsburg-Stadt" if district_code == 252 & election == "2013 German federal election"
replace district_name = "Augsburg-Land" if district_code == 253 & election == "2013 German federal election"
replace district_name = "Donau-Ries" if district_code == 254 & election == "2013 German federal election"
replace district_name = "Neu-Ulm" if district_code == 255 & election == "2013 German federal election"
replace district_name = "Oberallgäu" if district_code == 256 & election == "2013 German federal election"
replace district_name = "Ostallgäu" if district_code == 257 & election == "2013 German federal election"
replace district_name = "Stuttgart I" if district_code == 258 & election == "2013 German federal election"
replace district_name = "Stuttgart II" if district_code == 259 & election == "2013 German federal election"
replace district_name = "Böblingen" if district_code == 260 & election == "2013 German federal election"
replace district_name = "Esslingen" if district_code == 261 & election == "2013 German federal election"
replace district_name = "Nürtingen" if district_code == 262 & election == "2013 German federal election"
replace district_name = "Göppingen" if district_code == 263 & election == "2013 German federal election"
replace district_name = "Waiblingen" if district_code == 264 & election == "2013 German federal election"
replace district_name = "Ludwigsburg" if district_code == 265 & election == "2013 German federal election"
replace district_name = "Neckar-Zaber" if district_code == 266 & election == "2013 German federal election"
replace district_name = "Heilbronn" if district_code == 267 & election == "2013 German federal election"
replace district_name = "Schwäbisch Hall - Hohenlohe" if district_code == 268 & election == "2013 German federal election"
replace district_name = "Backnang - Schwäbisch Gmünd" if district_code == 269 & election == "2013 German federal election"
replace district_name = "Aalen - Heidenheim" if district_code == 270 & election == "2013 German federal election"
replace district_name = "Karlsruhe-Stadt" if district_code == 271 & election == "2013 German federal election"
replace district_name = "Karlsruhe-Land" if district_code == 272 & election == "2013 German federal election"
replace district_name = "Rastatt" if district_code == 273 & election == "2013 German federal election"
replace district_name = "Heidelberg" if district_code == 274 & election == "2013 German federal election"
replace district_name = "Mannheim" if district_code == 275 & election == "2013 German federal election"
replace district_name = "Odenwald - Tauber" if district_code == 276 & election == "2013 German federal election"
replace district_name = "Rhein-Neckar" if district_code == 277 & election == "2013 German federal election"
replace district_name = "Bruchsal - Schwetzingen" if district_code == 278 & election == "2013 German federal election"
replace district_name = "Pforzheim" if district_code == 279 & election == "2013 German federal election"
replace district_name = "Calw" if district_code == 280 & election == "2013 German federal election"
replace district_name = "Freiburg" if district_code == 281 & election == "2013 German federal election"
replace district_name = "Lörrach - Müllheim" if district_code == 282 & election == "2013 German federal election"
replace district_name = "Emmendingen - Lahr" if district_code == 283 & election == "2013 German federal election"
replace district_name = "Offenburg" if district_code == 284 & election == "2013 German federal election"
replace district_name = "Rottweil - Tuttlingen" if district_code == 285 & election == "2013 German federal election"
replace district_name = "Schwarzwald-Baar" if district_code == 286 & election == "2013 German federal election"
replace district_name = "Konstanz" if district_code == 287 & election == "2013 German federal election"
replace district_name = "Waldshut" if district_code == 288 & election == "2013 German federal election"
replace district_name = "Reutlingen" if district_code == 289 & election == "2013 German federal election"
replace district_name = "Tübingen" if district_code == 290 & election == "2013 German federal election"
replace district_name = "Ulm" if district_code == 291 & election == "2013 German federal election"
replace district_name = "Biberach" if district_code == 292 & election == "2013 German federal election"
replace district_name = "Bodensee" if district_code == 293 & election == "2013 German federal election"
replace district_name = "Ravensburg" if district_code == 294 & election == "2013 German federal election"
replace district_name = "Zollernalb - Sigmaringen" if district_code == 295 & election == "2013 German federal election"
replace district_name = "Saarbrücken" if district_code == 296 & election == "2013 German federal election"
replace district_name = "Saarlouis" if district_code == 297 & election == "2013 German federal election"
replace district_name = "St. Wendel" if district_code == 298 & election == "2013 German federal election"
replace district_name = "Homburg" if district_code == 299 & election == "2013 German federal election"
replace district_name = "Flensburg – Schleswig" if district_code == 1 & election == "2017 German federal election"
replace district_name = "Nordfriesland – Dithmarschen Nord" if district_code == 2 & election == "2017 German federal election"
replace district_name = "Steinburg – Dithmarschen Süd" if district_code == 3 & election == "2017 German federal election"
replace district_name = "Rendsburg-Eckernförde" if district_code == 4 & election == "2017 German federal election"
replace district_name = "Kiel" if district_code == 5 & election == "2017 German federal election"
replace district_name = "Plön – Neumünster" if district_code == 6 & election == "2017 German federal election"
replace district_name = "Pinneberg" if district_code == 7 & election == "2017 German federal election"
replace district_name = "Segeberg – Stormarn-Mitte" if district_code == 8 & election == "2017 German federal election"
replace district_name = "Ostholstein – Stormarn-Nord" if district_code == 9 & election == "2017 German federal election"
replace district_name = "Herzogtum Lauenburg – Stormarn-Süd" if district_code == 10 & election == "2017 German federal election"
replace district_name = "Lübeck" if district_code == 11 & election == "2017 German federal election"
replace district_name = "Schwerin – Ludwigslust-Parchim I – Nordwestmecklenburg I" if district_code == 12 & election == "2017 German federal election"
replace district_name = "Ludwigslust-Parchim II – Nordwestmecklenburg II – Landkreis Rostock I" if district_code == 13 & election == "2017 German federal election"
replace district_name = "Rostock – Landkreis Rostock II" if district_code == 14 & election == "2017 German federal election"
replace district_name = "Vorpommern-Rügen – Vorpommern-Greifswald I" if district_code == 15 & election == "2017 German federal election"
replace district_name = "Mecklenburgische Seenplatte I – Vorpommern-Greifswald II" if district_code == 16 & election == "2017 German federal election"
replace district_name = "Mecklenburgische Seenplatte II – Landkreis Rostock III" if district_code == 17 & election == "2017 German federal election"
replace district_name = "Hamburg-Mitte" if district_code == 18 & election == "2017 German federal election"
replace district_name = "Hamburg-Altona" if district_code == 19 & election == "2017 German federal election"
replace district_name = "Hamburg-Eimsbüttel" if district_code == 20 & election == "2017 German federal election"
replace district_name = "Hamburg-Nord" if district_code == 21 & election == "2017 German federal election"
replace district_name = "Hamburg-Wandsbek" if district_code == 22 & election == "2017 German federal election"
replace district_name = "Hamburg-Bergedorf – Harburg" if district_code == 23 & election == "2017 German federal election"
replace district_name = "Aurich – Emden" if district_code == 24 & election == "2017 German federal election"
replace district_name = "Unterems" if district_code == 25 & election == "2017 German federal election"
replace district_name = "Friesland – Wilhelmshaven – Wittmund" if district_code == 26 & election == "2017 German federal election"
replace district_name = "Oldenburg – Ammerland" if district_code == 27 & election == "2017 German federal election"
replace district_name = "Delmenhorst – Wesermarsch – Oldenburg-Land" if district_code == 28 & election == "2017 German federal election"
replace district_name = "Cuxhaven – Stade II" if district_code == 29 & election == "2017 German federal election"
replace district_name = "Stade I – Rotenburg II" if district_code == 30 & election == "2017 German federal election"
replace district_name = "Mittelems" if district_code == 31 & election == "2017 German federal election"
replace district_name = "Cloppenburg – Vechta" if district_code == 32 & election == "2017 German federal election"
replace district_name = "Diepholz – Nienburg I" if district_code == 33 & election == "2017 German federal election"
replace district_name = "Osterholz – Verden" if district_code == 34 & election == "2017 German federal election"
replace district_name = "Rotenburg I – Heidekreis" if district_code == 35 & election == "2017 German federal election"
replace district_name = "Harburg" if district_code == 36 & election == "2017 German federal election"
replace district_name = "Lüchow-Dannenberg – Lüneburg" if district_code == 37 & election == "2017 German federal election"
replace district_name = "Osnabrück-Land" if district_code == 38 & election == "2017 German federal election"
replace district_name = "Stadt Osnabrück" if district_code == 39 & election == "2017 German federal election"
replace district_name = "Nienburg II – Schaumburg" if district_code == 40 & election == "2017 German federal election"
replace district_name = "Stadt Hannover I" if district_code == 41 & election == "2017 German federal election"
replace district_name = "Stadt Hannover II" if district_code == 42 & election == "2017 German federal election"
replace district_name = "Hannover-Land I" if district_code == 43 & election == "2017 German federal election"
replace district_name = "Celle – Uelzen" if district_code == 44 & election == "2017 German federal election"
replace district_name = "Gifhorn – Peine" if district_code == 45 & election == "2017 German federal election"
replace district_name = "Hameln-Pyrmont – Holzminden" if district_code == 46 & election == "2017 German federal election"
replace district_name = "Hannover-Land II" if district_code == 47 & election == "2017 German federal election"
replace district_name = "Hildesheim" if district_code == 48 & election == "2017 German federal election"
replace district_name = "Salzgitter – Wolfenbüttel" if district_code == 49 & election == "2017 German federal election"
replace district_name = "Braunschweig" if district_code == 50 & election == "2017 German federal election"
replace district_name = "Helmstedt – Wolfsburg" if district_code == 51 & election == "2017 German federal election"
replace district_name = "Goslar – Northeim – Osterode" if district_code == 52 & election == "2017 German federal election"
replace district_name = "Göttingen" if district_code == 53 & election == "2017 German federal election"
replace district_name = "Bremen I" if district_code == 54 & election == "2017 German federal election"
replace district_name = "Bremen II – Bremerhaven" if district_code == 55 & election == "2017 German federal election"
replace district_name = "Prignitz – Ostprignitz-Ruppin – Havelland I" if district_code == 56 & election == "2017 German federal election"
replace district_name = "Uckermark – Barnim I" if district_code == 57 & election == "2017 German federal election"
replace district_name = "Oberhavel – Havelland II" if district_code == 58 & election == "2017 German federal election"
replace district_name = "Märkisch-Oderland – Barnim II" if district_code == 59 & election == "2017 German federal election"
replace district_name = "Brandenburg an der Havel – Potsdam-Mittelmark I – Havelland III – Teltow-Fläming I" if district_code == 60 & election == "2017 German federal election"
replace district_name = "Potsdam – Potsdam-Mittelmark II – Teltow-Fläming II" if district_code == 61 & election == "2017 German federal election"
replace district_name = "Dahme-Spreewald – Teltow-Fläming III – Oberspreewald-Lausitz I" if district_code == 62 & election == "2017 German federal election"
replace district_name = "Frankfurt (Oder) – Oder-Spree" if district_code == 63 & election == "2017 German federal election"
replace district_name = "Cottbus – Spree-Neiße" if district_code == 64 & election == "2017 German federal election"
replace district_name = "Elbe-Elster – Oberspreewald-Lausitz II" if district_code == 65 & election == "2017 German federal election"
replace district_name = "Altmark" if district_code == 66 & election == "2017 German federal election"
replace district_name = "Börde – Jerichower Land" if district_code == 67 & election == "2017 German federal election"
replace district_name = "Harz" if district_code == 68 & election == "2017 German federal election"
replace district_name = "Magdeburg" if district_code == 69 & election == "2017 German federal election"
replace district_name = "Dessau – Wittenberg" if district_code == 70 & election == "2017 German federal election"
replace district_name = "Anhalt" if district_code == 71 & election == "2017 German federal election"
replace district_name = "Halle" if district_code == 72 & election == "2017 German federal election"
replace district_name = "Burgenland – Saalekreis" if district_code == 73 & election == "2017 German federal election"
replace district_name = "Mansfeld" if district_code == 74 & election == "2017 German federal election"
replace district_name = "Berlin-Mitte" if district_code == 75 & election == "2017 German federal election"
replace district_name = "Berlin-Pankow" if district_code == 76 & election == "2017 German federal election"
replace district_name = "Berlin-Reinickendorf" if district_code == 77 & election == "2017 German federal election"
replace district_name = "Berlin-Spandau – Charlottenburg Nord" if district_code == 78 & election == "2017 German federal election"
replace district_name = "Berlin-Steglitz-Zehlendorf" if district_code == 79 & election == "2017 German federal election"
replace district_name = "Berlin-Charlottenburg-Wilmersdorf" if district_code == 80 & election == "2017 German federal election"
replace district_name = "Berlin-Tempelhof-Schöneberg" if district_code == 81 & election == "2017 German federal election"
replace district_name = "Berlin-Neukölln" if district_code == 82 & election == "2017 German federal election"
replace district_name = "Berlin-Friedrichshain-Kreuzberg – Prenzlauer Berg Ost" if district_code == 83 & election == "2017 German federal election"
replace district_name = "Berlin-Treptow-Köpenick" if district_code == 84 & election == "2017 German federal election"
replace district_name = "Berlin-Marzahn-Hellersdorf" if district_code == 85 & election == "2017 German federal election"
replace district_name = "Berlin-Lichtenberg" if district_code == 86 & election == "2017 German federal election"
replace district_name = "Aachen I" if district_code == 87 & election == "2017 German federal election"
replace district_name = "Aachen II" if district_code == 88 & election == "2017 German federal election"
replace district_name = "Heinsberg" if district_code == 89 & election == "2017 German federal election"
replace district_name = "Düren" if district_code == 90 & election == "2017 German federal election"
replace district_name = "Rhein-Erft-Kreis I" if district_code == 91 & election == "2017 German federal election"
replace district_name = "Euskirchen – Rhein-Erft-Kreis II" if district_code == 92 & election == "2017 German federal election"
replace district_name = "Köln I" if district_code == 93 & election == "2017 German federal election"
replace district_name = "Köln II" if district_code == 94 & election == "2017 German federal election"
replace district_name = "Köln III" if district_code == 95 & election == "2017 German federal election"
replace district_name = "Bonn" if district_code == 96 & election == "2017 German federal election"
replace district_name = "Rhein-Sieg-Kreis I" if district_code == 97 & election == "2017 German federal election"
replace district_name = "Rhein-Sieg-Kreis II" if district_code == 98 & election == "2017 German federal election"
replace district_name = "Oberbergischer Kreis" if district_code == 99 & election == "2017 German federal election"
replace district_name = "Rheinisch-Bergischer Kreis" if district_code == 100 & election == "2017 German federal election"
replace district_name = "Leverkusen – Köln IV" if district_code == 101 & election == "2017 German federal election"
replace district_name = "Wuppertal I" if district_code == 102 & election == "2017 German federal election"
replace district_name = "Solingen – Remscheid – Wuppertal II" if district_code == 103 & election == "2017 German federal election"
replace district_name = "Mettmann I" if district_code == 104 & election == "2017 German federal election"
replace district_name = "Mettmann II" if district_code == 105 & election == "2017 German federal election"
replace district_name = "Düsseldorf I" if district_code == 106 & election == "2017 German federal election"
replace district_name = "Düsseldorf II" if district_code == 107 & election == "2017 German federal election"
replace district_name = "Neuss I" if district_code == 108 & election == "2017 German federal election"
replace district_name = "Mönchengladbach" if district_code == 109 & election == "2017 German federal election"
replace district_name = "Krefeld I – Neuss II" if district_code == 110 & election == "2017 German federal election"
replace district_name = "Viersen" if district_code == 111 & election == "2017 German federal election"
replace district_name = "Kleve" if district_code == 112 & election == "2017 German federal election"
replace district_name = "Wesel I" if district_code == 113 & election == "2017 German federal election"
replace district_name = "Krefeld II – Wesel II" if district_code == 114 & election == "2017 German federal election"
replace district_name = "Duisburg I" if district_code == 115 & election == "2017 German federal election"
replace district_name = "Duisburg II" if district_code == 116 & election == "2017 German federal election"
replace district_name = "Oberhausen – Wesel III" if district_code == 117 & election == "2017 German federal election"
replace district_name = "Mülheim – Essen I" if district_code == 118 & election == "2017 German federal election"
replace district_name = "Essen II" if district_code == 119 & election == "2017 German federal election"
replace district_name = "Essen III" if district_code == 120 & election == "2017 German federal election"
replace district_name = "Recklinghausen I" if district_code == 121 & election == "2017 German federal election"
replace district_name = "Recklinghausen II" if district_code == 122 & election == "2017 German federal election"
replace district_name = "Gelsenkirchen" if district_code == 123 & election == "2017 German federal election"
replace district_name = "Steinfurt I – Borken I" if district_code == 124 & election == "2017 German federal election"
replace district_name = "Bottrop – Recklinghausen III" if district_code == 125 & election == "2017 German federal election"
replace district_name = "Borken II" if district_code == 126 & election == "2017 German federal election"
replace district_name = "Coesfeld – Steinfurt II" if district_code == 127 & election == "2017 German federal election"
replace district_name = "Steinfurt III" if district_code == 128 & election == "2017 German federal election"
replace district_name = "Münster" if district_code == 129 & election == "2017 German federal election"
replace district_name = "Warendorf" if district_code == 130 & election == "2017 German federal election"
replace district_name = "Gütersloh I" if district_code == 131 & election == "2017 German federal election"
replace district_name = "Bielefeld – Gütersloh II" if district_code == 132 & election == "2017 German federal election"
replace district_name = "Herford – Minden-Lübbecke II" if district_code == 133 & election == "2017 German federal election"
replace district_name = "Minden-Lübbecke I" if district_code == 134 & election == "2017 German federal election"
replace district_name = "Lippe I" if district_code == 135 & election == "2017 German federal election"
replace district_name = "Höxter – Lippe II" if district_code == 136 & election == "2017 German federal election"
replace district_name = "Paderborn – Gütersloh III" if district_code == 137 & election == "2017 German federal election"
replace district_name = "Hagen – Ennepe-Ruhr-Kreis I" if district_code == 138 & election == "2017 German federal election"
replace district_name = "Ennepe-Ruhr-Kreis II" if district_code == 139 & election == "2017 German federal election"
replace district_name = "Bochum I" if district_code == 140 & election == "2017 German federal election"
replace district_name = "Herne – Bochum II" if district_code == 141 & election == "2017 German federal election"
replace district_name = "Dortmund I" if district_code == 142 & election == "2017 German federal election"
replace district_name = "Dortmund II" if district_code == 143 & election == "2017 German federal election"
replace district_name = "Unna I" if district_code == 144 & election == "2017 German federal election"
replace district_name = "Hamm – Unna II" if district_code == 145 & election == "2017 German federal election"
replace district_name = "Soest" if district_code == 146 & election == "2017 German federal election"
replace district_name = "Hochsauerlandkreis" if district_code == 147 & election == "2017 German federal election"
replace district_name = "Siegen-Wittgenstein" if district_code == 148 & election == "2017 German federal election"
replace district_name = "Olpe – Märkischer Kreis I" if district_code == 149 & election == "2017 German federal election"
replace district_name = "Märkischer Kreis II" if district_code == 150 & election == "2017 German federal election"
replace district_name = "Nordsachsen" if district_code == 151 & election == "2017 German federal election"
replace district_name = "Leipzig I" if district_code == 152 & election == "2017 German federal election"
replace district_name = "Leipzig II" if district_code == 153 & election == "2017 German federal election"
replace district_name = "Leipzig-Land" if district_code == 154 & election == "2017 German federal election"
replace district_name = "Meißen" if district_code == 155 & election == "2017 German federal election"
replace district_name = "Bautzen I" if district_code == 156 & election == "2017 German federal election"
replace district_name = "Görlitz" if district_code == 157 & election == "2017 German federal election"
replace district_name = "Sächsische Schweiz-Osterzgebirge" if district_code == 158 & election == "2017 German federal election"
replace district_name = "Dresden I" if district_code == 159 & election == "2017 German federal election"
replace district_name = "Dresden II – Bautzen II" if district_code == 160 & election == "2017 German federal election"
replace district_name = "Mittelsachsen" if district_code == 161 & election == "2017 German federal election"
replace district_name = "Chemnitz" if district_code == 162 & election == "2017 German federal election"
replace district_name = "Chemnitzer Umland – Erzgebirgskreis II" if district_code == 163 & election == "2017 German federal election"
replace district_name = "Erzgebirgskreis I" if district_code == 164 & election == "2017 German federal election"
replace district_name = "Zwickau" if district_code == 165 & election == "2017 German federal election"
replace district_name = "Vogtlandkreis" if district_code == 166 & election == "2017 German federal election"
replace district_name = "Waldeck" if district_code == 167 & election == "2017 German federal election"
replace district_name = "Kassel" if district_code == 168 & election == "2017 German federal election"
replace district_name = "Werra-Meißner – Hersfeld-Rotenburg" if district_code == 169 & election == "2017 German federal election"
replace district_name = "Schwalm-Eder" if district_code == 170 & election == "2017 German federal election"
replace district_name = "Marburg" if district_code == 171 & election == "2017 German federal election"
replace district_name = "Lahn-Dill" if district_code == 172 & election == "2017 German federal election"
replace district_name = "Gießen" if district_code == 173 & election == "2017 German federal election"
replace district_name = "Fulda" if district_code == 174 & election == "2017 German federal election"
replace district_name = "Main-Kinzig – Wetterau II – Schotten" if district_code == 175 & election == "2017 German federal election"
replace district_name = "Hochtaunus" if district_code == 176 & election == "2017 German federal election"
replace district_name = "Wetterau I" if district_code == 177 & election == "2017 German federal election"
replace district_name = "Rheingau-Taunus – Limburg" if district_code == 178 & election == "2017 German federal election"
replace district_name = "Wiesbaden" if district_code == 179 & election == "2017 German federal election"
replace district_name = "Hanau" if district_code == 180 & election == "2017 German federal election"
replace district_name = "Main-Taunus" if district_code == 181 & election == "2017 German federal election"
replace district_name = "Frankfurt am Main I" if district_code == 182 & election == "2017 German federal election"
replace district_name = "Frankfurt am Main II" if district_code == 183 & election == "2017 German federal election"
replace district_name = "Groß-Gerau" if district_code == 184 & election == "2017 German federal election"
replace district_name = "Offenbach" if district_code == 185 & election == "2017 German federal election"
replace district_name = "Darmstadt" if district_code == 186 & election == "2017 German federal election"
replace district_name = "Odenwald" if district_code == 187 & election == "2017 German federal election"
replace district_name = "Bergstraße" if district_code == 188 & election == "2017 German federal election"
replace district_name = "Eichsfeld – Nordhausen – Kyffhäuserkreis" if district_code == 189 & election == "2017 German federal election"
replace district_name = "Eisenach – Wartburgkreis – Unstrut-Hainich-Kreis" if district_code == 190 & election == "2017 German federal election"
replace district_name = "Jena – Sömmerda – Weimarer Land I" if district_code == 191 & election == "2017 German federal election"
replace district_name = "Gotha – Ilm-Kreis" if district_code == 192 & election == "2017 German federal election"
replace district_name = "Erfurt – Weimar – Weimarer Land II" if district_code == 193 & election == "2017 German federal election"
replace district_name = "Gera – Greiz – Altenburger Land" if district_code == 194 & election == "2017 German federal election"
replace district_name = "Saalfeld-Rudolstadt – Saale-Holzland-Kreis – Saale-Orla-Kreis" if district_code == 195 & election == "2017 German federal election"
replace district_name = "Suhl – Schmalkalden-Meiningen – Hildburghausen – Sonneberg" if district_code == 196 & election == "2017 German federal election"
replace district_name = "Neuwied" if district_code == 197 & election == "2017 German federal election"
replace district_name = "Ahrweiler" if district_code == 198 & election == "2017 German federal election"
replace district_name = "Koblenz" if district_code == 199 & election == "2017 German federal election"
replace district_name = "Mosel/Rhein-Hunsrück" if district_code == 200 & election == "2017 German federal election"
replace district_name = "Kreuznach" if district_code == 201 & election == "2017 German federal election"
replace district_name = "Bitburg" if district_code == 202 & election == "2017 German federal election"
replace district_name = "Trier" if district_code == 203 & election == "2017 German federal election"
replace district_name = "Montabaur" if district_code == 204 & election == "2017 German federal election"
replace district_name = "Mainz" if district_code == 205 & election == "2017 German federal election"
replace district_name = "Worms" if district_code == 206 & election == "2017 German federal election"
replace district_name = "Ludwigshafen/Frankenthal" if district_code == 207 & election == "2017 German federal election"
replace district_name = "Neustadt – Speyer" if district_code == 208 & election == "2017 German federal election"
replace district_name = "Kaiserslautern" if district_code == 209 & election == "2017 German federal election"
replace district_name = "Pirmasens" if district_code == 210 & election == "2017 German federal election"
replace district_name = "Südpfalz" if district_code == 211 & election == "2017 German federal election"
replace district_name = "Altötting" if district_code == 212 & election == "2017 German federal election"
replace district_name = "Erding – Ebersberg" if district_code == 213 & election == "2017 German federal election"
replace district_name = "Freising" if district_code == 214 & election == "2017 German federal election"
replace district_name = "Fürstenfeldbruck" if district_code == 215 & election == "2017 German federal election"
replace district_name = "Ingolstadt" if district_code == 216 & election == "2017 German federal election"
replace district_name = "München-Nord" if district_code == 217 & election == "2017 German federal election"
replace district_name = "München-Ost" if district_code == 218 & election == "2017 German federal election"
replace district_name = "München-Süd" if district_code == 219 & election == "2017 German federal election"
replace district_name = "München-West/Mitte" if district_code == 220 & election == "2017 German federal election"
replace district_name = "München-Land" if district_code == 221 & election == "2017 German federal election"
replace district_name = "Rosenheim" if district_code == 222 & election == "2017 German federal election"
replace district_name = "Bad Tölz-Wolfratshausen – Miesbach" if district_code == 223 & election == "2017 German federal election"
replace district_name = "Starnberg – Landsberg am Lech" if district_code == 224 & election == "2017 German federal election"
replace district_name = "Traunstein" if district_code == 225 & election == "2017 German federal election"
replace district_name = "Weilheim" if district_code == 226 & election == "2017 German federal election"
replace district_name = "Deggendorf" if district_code == 227 & election == "2017 German federal election"
replace district_name = "Landshut" if district_code == 228 & election == "2017 German federal election"
replace district_name = "Passau" if district_code == 229 & election == "2017 German federal election"
replace district_name = "Rottal-Inn" if district_code == 230 & election == "2017 German federal election"
replace district_name = "Straubing" if district_code == 231 & election == "2017 German federal election"
replace district_name = "Amberg" if district_code == 232 & election == "2017 German federal election"
replace district_name = "Regensburg" if district_code == 233 & election == "2017 German federal election"
replace district_name = "Schwandorf" if district_code == 234 & election == "2017 German federal election"
replace district_name = "Weiden" if district_code == 235 & election == "2017 German federal election"
replace district_name = "Bamberg" if district_code == 236 & election == "2017 German federal election"
replace district_name = "Bayreuth" if district_code == 237 & election == "2017 German federal election"
replace district_name = "Coburg" if district_code == 238 & election == "2017 German federal election"
replace district_name = "Hof" if district_code == 239 & election == "2017 German federal election"
replace district_name = "Kulmbach" if district_code == 240 & election == "2017 German federal election"
replace district_name = "Ansbach" if district_code == 241 & election == "2017 German federal election"
replace district_name = "Erlangen" if district_code == 242 & election == "2017 German federal election"
replace district_name = "Fürth" if district_code == 243 & election == "2017 German federal election"
replace district_name = "Nürnberg-Nord" if district_code == 244 & election == "2017 German federal election"
replace district_name = "Nürnberg-Süd" if district_code == 245 & election == "2017 German federal election"
replace district_name = "Roth" if district_code == 246 & election == "2017 German federal election"
replace district_name = "Aschaffenburg" if district_code == 247 & election == "2017 German federal election"
replace district_name = "Bad Kissingen" if district_code == 248 & election == "2017 German federal election"
replace district_name = "Main-Spessart" if district_code == 249 & election == "2017 German federal election"
replace district_name = "Schweinfurt" if district_code == 250 & election == "2017 German federal election"
replace district_name = "Würzburg" if district_code == 251 & election == "2017 German federal election"
replace district_name = "Augsburg-Stadt" if district_code == 252 & election == "2017 German federal election"
replace district_name = "Augsburg-Land" if district_code == 253 & election == "2017 German federal election"
replace district_name = "Donau-Ries" if district_code == 254 & election == "2017 German federal election"
replace district_name = "Neu-Ulm" if district_code == 255 & election == "2017 German federal election"
replace district_name = "Oberallgäu" if district_code == 256 & election == "2017 German federal election"
replace district_name = "Ostallgäu" if district_code == 257 & election == "2017 German federal election"
replace district_name = "Stuttgart I" if district_code == 258 & election == "2017 German federal election"
replace district_name = "Stuttgart II" if district_code == 259 & election == "2017 German federal election"
replace district_name = "Böblingen" if district_code == 260 & election == "2017 German federal election"
replace district_name = "Esslingen" if district_code == 261 & election == "2017 German federal election"
replace district_name = "Nürtingen" if district_code == 262 & election == "2017 German federal election"
replace district_name = "Göppingen" if district_code == 263 & election == "2017 German federal election"
replace district_name = "Waiblingen" if district_code == 264 & election == "2017 German federal election"
replace district_name = "Ludwigsburg" if district_code == 265 & election == "2017 German federal election"
replace district_name = "Neckar-Zaber" if district_code == 266 & election == "2017 German federal election"
replace district_name = "Heilbronn" if district_code == 267 & election == "2017 German federal election"
replace district_name = "Schwäbisch Hall – Hohenlohe" if district_code == 268 & election == "2017 German federal election"
replace district_name = "Backnang – Schwäbisch Gmünd" if district_code == 269 & election == "2017 German federal election"
replace district_name = "Aalen – Heidenheim" if district_code == 270 & election == "2017 German federal election"
replace district_name = "Karlsruhe-Stadt" if district_code == 271 & election == "2017 German federal election"
replace district_name = "Karlsruhe-Land" if district_code == 272 & election == "2017 German federal election"
replace district_name = "Rastatt" if district_code == 273 & election == "2017 German federal election"
replace district_name = "Heidelberg" if district_code == 274 & election == "2017 German federal election"
replace district_name = "Mannheim" if district_code == 275 & election == "2017 German federal election"
replace district_name = "Odenwald – Tauber" if district_code == 276 & election == "2017 German federal election"
replace district_name = "Rhein-Neckar" if district_code == 277 & election == "2017 German federal election"
replace district_name = "Bruchsal – Schwetzingen" if district_code == 278 & election == "2017 German federal election"
replace district_name = "Pforzheim" if district_code == 279 & election == "2017 German federal election"
replace district_name = "Calw" if district_code == 280 & election == "2017 German federal election"
replace district_name = "Freiburg" if district_code == 281 & election == "2017 German federal election"
replace district_name = "Lörrach – Müllheim" if district_code == 282 & election == "2017 German federal election"
replace district_name = "Emmendingen – Lahr" if district_code == 283 & election == "2017 German federal election"
replace district_name = "Offenburg" if district_code == 284 & election == "2017 German federal election"
replace district_name = "Rottweil – Tuttlingen" if district_code == 285 & election == "2017 German federal election"
replace district_name = "Schwarzwald-Baar" if district_code == 286 & election == "2017 German federal election"
replace district_name = "Konstanz" if district_code == 287 & election == "2017 German federal election"
replace district_name = "Waldshut" if district_code == 288 & election == "2017 German federal election"
replace district_name = "Reutlingen" if district_code == 289 & election == "2017 German federal election"
replace district_name = "Tübingen" if district_code == 290 & election == "2017 German federal election"
replace district_name = "Ulm" if district_code == 291 & election == "2017 German federal election"
replace district_name = "Biberach" if district_code == 292 & election == "2017 German federal election"
replace district_name = "Bodensee" if district_code == 293 & election == "2017 German federal election"
replace district_name = "Ravensburg" if district_code == 294 & election == "2017 German federal election"
replace district_name = "Zollernalb – Sigmaringen" if district_code == 295 & election == "2017 German federal election"
replace district_name = "Saarbrücken" if district_code == 296 & election == "2017 German federal election"
replace district_name = "Saarlouis" if district_code == 297 & election == "2017 German federal election"
replace district_name = "St. Wendel" if district_code == 298 & election == "2017 German federal election"
replace district_name = "Homburg" if district_code == 299 & election == "2017 German federal election"
replace district_name = "Flensburg – Schleswig" if district_code == 1 & election == "2021 German federal election"
replace district_name = "Nordfriesland – Dithmarschen Nord" if district_code == 2 & election == "2021 German federal election"
replace district_name = "Steinburg – Dithmarschen Süd" if district_code == 3 & election == "2021 German federal election"
replace district_name = "Rendsburg-Eckernförde" if district_code == 4 & election == "2021 German federal election"
replace district_name = "Kiel" if district_code == 5 & election == "2021 German federal election"
replace district_name = "Plön – Neumünster" if district_code == 6 & election == "2021 German federal election"
replace district_name = "Pinneberg" if district_code == 7 & election == "2021 German federal election"
replace district_name = "Segeberg – Stormarn-Mitte" if district_code == 8 & election == "2021 German federal election"
replace district_name = "Ostholstein – Stormarn-Nord" if district_code == 9 & election == "2021 German federal election"
replace district_name = "Herzogtum Lauenburg – Stormarn-Süd" if district_code == 10 & election == "2021 German federal election"
replace district_name = "Lübeck" if district_code == 11 & election == "2021 German federal election"
replace district_name = "Schwerin – Ludwigslust-Parchim I – Nordwestmecklenburg I" if district_code == 12 & election == "2021 German federal election"
replace district_name = "Ludwigslust-Parchim II – Nordwestmecklenburg II – Landkreis Rostock I" if district_code == 13 & election == "2021 German federal election"
replace district_name = "Rostock – Landkreis Rostock II" if district_code == 14 & election == "2021 German federal election"
replace district_name = "Vorpommern-Rügen – Vorpommern-Greifswald I" if district_code == 15 & election == "2021 German federal election"
replace district_name = "Mecklenburgische Seenplatte I – Vorpommern-Greifswald II" if district_code == 16 & election == "2021 German federal election"
replace district_name = "Mecklenburgische Seenplatte II – Landkreis Rostock III" if district_code == 17 & election == "2021 German federal election"
replace district_name = "Hamburg-Mitte" if district_code == 18 & election == "2021 German federal election"
replace district_name = "Hamburg-Altona" if district_code == 19 & election == "2021 German federal election"
replace district_name = "Hamburg-Eimsbüttel" if district_code == 20 & election == "2021 German federal election"
replace district_name = "Hamburg-Nord" if district_code == 21 & election == "2021 German federal election"
replace district_name = "Hamburg-Wandsbek" if district_code == 22 & election == "2021 German federal election"
replace district_name = "Hamburg-Bergedorf – Harburg" if district_code == 23 & election == "2021 German federal election"
replace district_name = "Aurich – Emden" if district_code == 24 & election == "2021 German federal election"
replace district_name = "Unterems" if district_code == 25 & election == "2021 German federal election"
replace district_name = "Friesland – Wilhelmshaven – Wittmund" if district_code == 26 & election == "2021 German federal election"
replace district_name = "Oldenburg – Ammerland" if district_code == 27 & election == "2021 German federal election"
replace district_name = "Delmenhorst – Wesermarsch – Oldenburg-Land" if district_code == 28 & election == "2021 German federal election"
replace district_name = "Cuxhaven – Stade II" if district_code == 29 & election == "2021 German federal election"
replace district_name = "Stade I – Rotenburg II" if district_code == 30 & election == "2021 German federal election"
replace district_name = "Mittelems" if district_code == 31 & election == "2021 German federal election"
replace district_name = "Cloppenburg – Vechta" if district_code == 32 & election == "2021 German federal election"
replace district_name = "Diepholz – Nienburg I" if district_code == 33 & election == "2021 German federal election"
replace district_name = "Osterholz – Verden" if district_code == 34 & election == "2021 German federal election"
replace district_name = "Rotenburg I – Heidekreis" if district_code == 35 & election == "2021 German federal election"
replace district_name = "Harburg" if district_code == 36 & election == "2021 German federal election"
replace district_name = "Lüchow-Dannenberg – Lüneburg" if district_code == 37 & election == "2021 German federal election"
replace district_name = "Osnabrück-Land" if district_code == 38 & election == "2021 German federal election"
replace district_name = "Stadt Osnabrück" if district_code == 39 & election == "2021 German federal election"
replace district_name = "Nienburg II – Schaumburg" if district_code == 40 & election == "2021 German federal election"
replace district_name = "Stadt Hannover I" if district_code == 41 & election == "2021 German federal election"
replace district_name = "Stadt Hannover II" if district_code == 42 & election == "2021 German federal election"
replace district_name = "Hannover-Land I" if district_code == 43 & election == "2021 German federal election"
replace district_name = "Celle – Uelzen" if district_code == 44 & election == "2021 German federal election"
replace district_name = "Gifhorn – Peine" if district_code == 45 & election == "2021 German federal election"
replace district_name = "Hameln-Pyrmont – Holzminden" if district_code == 46 & election == "2021 German federal election"
replace district_name = "Hannover-Land II" if district_code == 47 & election == "2021 German federal election"
replace district_name = "Hildesheim" if district_code == 48 & election == "2021 German federal election"
replace district_name = "Salzgitter – Wolfenbüttel" if district_code == 49 & election == "2021 German federal election"
replace district_name = "Braunschweig" if district_code == 50 & election == "2021 German federal election"
replace district_name = "Helmstedt – Wolfsburg" if district_code == 51 & election == "2021 German federal election"
replace district_name = "Goslar – Northeim – Osterode" if district_code == 52 & election == "2021 German federal election"
replace district_name = "Göttingen" if district_code == 53 & election == "2021 German federal election"
replace district_name = "Bremen I" if district_code == 54 & election == "2021 German federal election"
replace district_name = "Bremen II – Bremerhaven" if district_code == 55 & election == "2021 German federal election"
replace district_name = "Prignitz – Ostprignitz-Ruppin – Havelland I" if district_code == 56 & election == "2021 German federal election"
replace district_name = "Uckermark – Barnim I" if district_code == 57 & election == "2021 German federal election"
replace district_name = "Oberhavel – Havelland II" if district_code == 58 & election == "2021 German federal election"
replace district_name = "Märkisch-Oderland – Barnim II" if district_code == 59 & election == "2021 German federal election"
replace district_name = "Brandenburg an der Havel – Potsdam-Mittelmark I – Havelland III – Teltow-Fläming I" if district_code == 60 & election == "2021 German federal election"
replace district_name = "Potsdam – Potsdam-Mittelmark II – Teltow-Fläming II" if district_code == 61 & election == "2021 German federal election"
replace district_name = "Dahme-Spreewald – Teltow-Fläming III – Oberspreewald-Lausitz I" if district_code == 62 & election == "2021 German federal election"
replace district_name = "Frankfurt (Oder) – Oder-Spree" if district_code == 63 & election == "2021 German federal election"
replace district_name = "Cottbus – Spree-Neiße" if district_code == 64 & election == "2021 German federal election"
replace district_name = "Elbe-Elster – Oberspreewald-Lausitz II" if district_code == 65 & election == "2021 German federal election"
replace district_name = "Altmark" if district_code == 66 & election == "2021 German federal election"
replace district_name = "Börde – Jerichower Land" if district_code == 67 & election == "2021 German federal election"
replace district_name = "Harz" if district_code == 68 & election == "2021 German federal election"
replace district_name = "Magdeburg" if district_code == 69 & election == "2021 German federal election"
replace district_name = "Dessau – Wittenberg" if district_code == 70 & election == "2021 German federal election"
replace district_name = "Anhalt" if district_code == 71 & election == "2021 German federal election"
replace district_name = "Halle" if district_code == 72 & election == "2021 German federal election"
replace district_name = "Burgenland – Saalekreis" if district_code == 73 & election == "2021 German federal election"
replace district_name = "Mansfeld" if district_code == 74 & election == "2021 German federal election"
replace district_name = "Berlin-Mitte" if district_code == 75 & election == "2021 German federal election"
replace district_name = "Berlin-Pankow" if district_code == 76 & election == "2021 German federal election"
replace district_name = "Berlin-Reinickendorf" if district_code == 77 & election == "2021 German federal election"
replace district_name = "Berlin-Spandau – Charlottenburg Nord" if district_code == 78 & election == "2021 German federal election"
replace district_name = "Berlin-Steglitz-Zehlendorf" if district_code == 79 & election == "2021 German federal election"
replace district_name = "Berlin-Charlottenburg-Wilmersdorf" if district_code == 80 & election == "2021 German federal election"
replace district_name = "Berlin-Tempelhof-Schöneberg" if district_code == 81 & election == "2021 German federal election"
replace district_name = "Berlin-Neukölln" if district_code == 82 & election == "2021 German federal election"
replace district_name = "Berlin-Friedrichshain-Kreuzberg – Prenzlauer Berg Ost" if district_code == 83 & election == "2021 German federal election"
replace district_name = "Berlin-Treptow-Köpenick" if district_code == 84 & election == "2021 German federal election"
replace district_name = "Berlin-Marzahn-Hellersdorf" if district_code == 85 & election == "2021 German federal election"
replace district_name = "Berlin-Lichtenberg" if district_code == 86 & election == "2021 German federal election"
replace district_name = "Aachen I" if district_code == 87 & election == "2021 German federal election"
replace district_name = "Aachen II" if district_code == 88 & election == "2021 German federal election"
replace district_name = "Heinsberg" if district_code == 89 & election == "2021 German federal election"
replace district_name = "Düren" if district_code == 90 & election == "2021 German federal election"
replace district_name = "Rhein-Erft-Kreis I" if district_code == 91 & election == "2021 German federal election"
replace district_name = "Euskirchen – Rhein-Erft-Kreis II" if district_code == 92 & election == "2021 German federal election"
replace district_name = "Köln I" if district_code == 93 & election == "2021 German federal election"
replace district_name = "Köln II" if district_code == 94 & election == "2021 German federal election"
replace district_name = "Köln III" if district_code == 95 & election == "2021 German federal election"
replace district_name = "Bonn" if district_code == 96 & election == "2021 German federal election"
replace district_name = "Rhein-Sieg-Kreis I" if district_code == 97 & election == "2021 German federal election"
replace district_name = "Rhein-Sieg-Kreis II" if district_code == 98 & election == "2021 German federal election"
replace district_name = "Oberbergischer Kreis" if district_code == 99 & election == "2021 German federal election"
replace district_name = "Rheinisch-Bergischer Kreis" if district_code == 100 & election == "2021 German federal election"
replace district_name = "Leverkusen – Köln IV" if district_code == 101 & election == "2021 German federal election"
replace district_name = "Wuppertal I" if district_code == 102 & election == "2021 German federal election"
replace district_name = "Solingen – Remscheid – Wuppertal II" if district_code == 103 & election == "2021 German federal election"
replace district_name = "Mettmann I" if district_code == 104 & election == "2021 German federal election"
replace district_name = "Mettmann II" if district_code == 105 & election == "2021 German federal election"
replace district_name = "Düsseldorf I" if district_code == 106 & election == "2021 German federal election"
replace district_name = "Düsseldorf II" if district_code == 107 & election == "2021 German federal election"
replace district_name = "Neuss I" if district_code == 108 & election == "2021 German federal election"
replace district_name = "Mönchengladbach" if district_code == 109 & election == "2021 German federal election"
replace district_name = "Krefeld I – Neuss II" if district_code == 110 & election == "2021 German federal election"
replace district_name = "Viersen" if district_code == 111 & election == "2021 German federal election"
replace district_name = "Kleve" if district_code == 112 & election == "2021 German federal election"
replace district_name = "Wesel I" if district_code == 113 & election == "2021 German federal election"
replace district_name = "Krefeld II – Wesel II" if district_code == 114 & election == "2021 German federal election"
replace district_name = "Duisburg I" if district_code == 115 & election == "2021 German federal election"
replace district_name = "Duisburg II" if district_code == 116 & election == "2021 German federal election"
replace district_name = "Oberhausen – Wesel III" if district_code == 117 & election == "2021 German federal election"
replace district_name = "Mülheim – Essen I" if district_code == 118 & election == "2021 German federal election"
replace district_name = "Essen II" if district_code == 119 & election == "2021 German federal election"
replace district_name = "Essen III" if district_code == 120 & election == "2021 German federal election"
replace district_name = "Recklinghausen I" if district_code == 121 & election == "2021 German federal election"
replace district_name = "Recklinghausen II" if district_code == 122 & election == "2021 German federal election"
replace district_name = "Gelsenkirchen" if district_code == 123 & election == "2021 German federal election"
replace district_name = "Steinfurt I – Borken I" if district_code == 124 & election == "2021 German federal election"
replace district_name = "Bottrop – Recklinghausen III" if district_code == 125 & election == "2021 German federal election"
replace district_name = "Borken II" if district_code == 126 & election == "2021 German federal election"
replace district_name = "Coesfeld – Steinfurt II" if district_code == 127 & election == "2021 German federal election"
replace district_name = "Steinfurt III" if district_code == 128 & election == "2021 German federal election"
replace district_name = "Münster" if district_code == 129 & election == "2021 German federal election"
replace district_name = "Warendorf" if district_code == 130 & election == "2021 German federal election"
replace district_name = "Gütersloh I" if district_code == 131 & election == "2021 German federal election"
replace district_name = "Bielefeld – Gütersloh II" if district_code == 132 & election == "2021 German federal election"
replace district_name = "Herford – Minden-Lübbecke II" if district_code == 133 & election == "2021 German federal election"
replace district_name = "Minden-Lübbecke I" if district_code == 134 & election == "2021 German federal election"
replace district_name = "Lippe I" if district_code == 135 & election == "2021 German federal election"
replace district_name = "Höxter – Lippe II" if district_code == 136 & election == "2021 German federal election"
replace district_name = "Paderborn – Gütersloh III" if district_code == 137 & election == "2021 German federal election"
replace district_name = "Hagen – Ennepe-Ruhr-Kreis I" if district_code == 138 & election == "2021 German federal election"
replace district_name = "Ennepe-Ruhr-Kreis II" if district_code == 139 & election == "2021 German federal election"
replace district_name = "Bochum I" if district_code == 140 & election == "2021 German federal election"
replace district_name = "Herne – Bochum II" if district_code == 141 & election == "2021 German federal election"
replace district_name = "Dortmund I" if district_code == 142 & election == "2021 German federal election"
replace district_name = "Dortmund II" if district_code == 143 & election == "2021 German federal election"
replace district_name = "Unna I" if district_code == 144 & election == "2021 German federal election"
replace district_name = "Hamm – Unna II" if district_code == 145 & election == "2021 German federal election"
replace district_name = "Soest" if district_code == 146 & election == "2021 German federal election"
replace district_name = "Hochsauerlandkreis" if district_code == 147 & election == "2021 German federal election"
replace district_name = "Siegen-Wittgenstein" if district_code == 148 & election == "2021 German federal election"
replace district_name = "Olpe – Märkischer Kreis I" if district_code == 149 & election == "2021 German federal election"
replace district_name = "Märkischer Kreis II" if district_code == 150 & election == "2021 German federal election"
replace district_name = "Nordsachsen" if district_code == 151 & election == "2021 German federal election"
replace district_name = "Leipzig I" if district_code == 152 & election == "2021 German federal election"
replace district_name = "Leipzig II" if district_code == 153 & election == "2021 German federal election"
replace district_name = "Leipzig-Land" if district_code == 154 & election == "2021 German federal election"
replace district_name = "Meißen" if district_code == 155 & election == "2021 German federal election"
replace district_name = "Bautzen I" if district_code == 156 & election == "2021 German federal election"
replace district_name = "Görlitz" if district_code == 157 & election == "2021 German federal election"
replace district_name = "Sächsische Schweiz-Osterzgebirge" if district_code == 158 & election == "2021 German federal election"
replace district_name = "Dresden I" if district_code == 159 & election == "2021 German federal election"
replace district_name = "Dresden II – Bautzen II" if district_code == 160 & election == "2021 German federal election"
replace district_name = "Mittelsachsen" if district_code == 161 & election == "2021 German federal election"
replace district_name = "Chemnitz" if district_code == 162 & election == "2021 German federal election"
replace district_name = "Chemnitzer Umland – Erzgebirgskreis II" if district_code == 163 & election == "2021 German federal election"
replace district_name = "Erzgebirgskreis I" if district_code == 164 & election == "2021 German federal election"
replace district_name = "Zwickau" if district_code == 165 & election == "2021 German federal election"
replace district_name = "Vogtlandkreis" if district_code == 166 & election == "2021 German federal election"
replace district_name = "Waldeck" if district_code == 167 & election == "2021 German federal election"
replace district_name = "Kassel" if district_code == 168 & election == "2021 German federal election"
replace district_name = "Werra-Meißner – Hersfeld-Rotenburg" if district_code == 169 & election == "2021 German federal election"
replace district_name = "Schwalm-Eder" if district_code == 170 & election == "2021 German federal election"
replace district_name = "Marburg" if district_code == 171 & election == "2021 German federal election"
replace district_name = "Lahn-Dill" if district_code == 172 & election == "2021 German federal election"
replace district_name = "Gießen" if district_code == 173 & election == "2021 German federal election"
replace district_name = "Fulda" if district_code == 174 & election == "2021 German federal election"
replace district_name = "Main-Kinzig – Wetterau II – Schotten" if district_code == 175 & election == "2021 German federal election"
replace district_name = "Hochtaunus" if district_code == 176 & election == "2021 German federal election"
replace district_name = "Wetterau I" if district_code == 177 & election == "2021 German federal election"
replace district_name = "Rheingau-Taunus – Limburg" if district_code == 178 & election == "2021 German federal election"
replace district_name = "Wiesbaden" if district_code == 179 & election == "2021 German federal election"
replace district_name = "Hanau" if district_code == 180 & election == "2021 German federal election"
replace district_name = "Main-Taunus" if district_code == 181 & election == "2021 German federal election"
replace district_name = "Frankfurt am Main I" if district_code == 182 & election == "2021 German federal election"
replace district_name = "Frankfurt am Main II" if district_code == 183 & election == "2021 German federal election"
replace district_name = "Groß-Gerau" if district_code == 184 & election == "2021 German federal election"
replace district_name = "Offenbach" if district_code == 185 & election == "2021 German federal election"
replace district_name = "Darmstadt" if district_code == 186 & election == "2021 German federal election"
replace district_name = "Odenwald" if district_code == 187 & election == "2021 German federal election"
replace district_name = "Bergstraße" if district_code == 188 & election == "2021 German federal election"
replace district_name = "Eichsfeld – Nordhausen – Kyffhäuserkreis" if district_code == 189 & election == "2021 German federal election"
replace district_name = "Eisenach – Wartburgkreis – Unstrut-Hainich-Kreis" if district_code == 190 & election == "2021 German federal election"
replace district_name = "Jena – Sömmerda – Weimarer Land I" if district_code == 191 & election == "2021 German federal election"
replace district_name = "Gotha – Ilm-Kreis" if district_code == 192 & election == "2021 German federal election"
replace district_name = "Erfurt – Weimar – Weimarer Land II" if district_code == 193 & election == "2021 German federal election"
replace district_name = "Gera – Greiz – Altenburger Land" if district_code == 194 & election == "2021 German federal election"
replace district_name = "Saalfeld-Rudolstadt – Saale-Holzland-Kreis – Saale-Orla-Kreis" if district_code == 195 & election == "2021 German federal election"
replace district_name = "Suhl – Schmalkalden-Meiningen – Hildburghausen – Sonneberg" if district_code == 196 & election == "2021 German federal election"
replace district_name = "Neuwied" if district_code == 197 & election == "2021 German federal election"
replace district_name = "Ahrweiler" if district_code == 198 & election == "2021 German federal election"
replace district_name = "Koblenz" if district_code == 199 & election == "2021 German federal election"
replace district_name = "Mosel/Rhein-Hunsrück" if district_code == 200 & election == "2021 German federal election"
replace district_name = "Kreuznach" if district_code == 201 & election == "2021 German federal election"
replace district_name = "Bitburg" if district_code == 202 & election == "2021 German federal election"
replace district_name = "Trier" if district_code == 203 & election == "2021 German federal election"
replace district_name = "Montabaur" if district_code == 204 & election == "2021 German federal election"
replace district_name = "Mainz" if district_code == 205 & election == "2021 German federal election"
replace district_name = "Worms" if district_code == 206 & election == "2021 German federal election"
replace district_name = "Ludwigshafen/Frankenthal" if district_code == 207 & election == "2021 German federal election"
replace district_name = "Neustadt – Speyer" if district_code == 208 & election == "2021 German federal election"
replace district_name = "Kaiserslautern" if district_code == 209 & election == "2021 German federal election"
replace district_name = "Pirmasens" if district_code == 210 & election == "2021 German federal election"
replace district_name = "Südpfalz" if district_code == 211 & election == "2021 German federal election"
replace district_name = "Altötting" if district_code == 212 & election == "2021 German federal election"
replace district_name = "Erding – Ebersberg" if district_code == 213 & election == "2021 German federal election"
replace district_name = "Freising" if district_code == 214 & election == "2021 German federal election"
replace district_name = "Fürstenfeldbruck" if district_code == 215 & election == "2021 German federal election"
replace district_name = "Ingolstadt" if district_code == 216 & election == "2021 German federal election"
replace district_name = "München-Nord" if district_code == 217 & election == "2021 German federal election"
replace district_name = "München-Ost" if district_code == 218 & election == "2021 German federal election"
replace district_name = "München-Süd" if district_code == 219 & election == "2021 German federal election"
replace district_name = "München-West/Mitte" if district_code == 220 & election == "2021 German federal election"
replace district_name = "München-Land" if district_code == 221 & election == "2021 German federal election"
replace district_name = "Rosenheim" if district_code == 222 & election == "2021 German federal election"
replace district_name = "Bad Tölz-Wolfratshausen – Miesbach" if district_code == 223 & election == "2021 German federal election"
replace district_name = "Starnberg – Landsberg am Lech" if district_code == 224 & election == "2021 German federal election"
replace district_name = "Traunstein" if district_code == 225 & election == "2021 German federal election"
replace district_name = "Weilheim" if district_code == 226 & election == "2021 German federal election"
replace district_name = "Deggendorf" if district_code == 227 & election == "2021 German federal election"
replace district_name = "Landshut" if district_code == 228 & election == "2021 German federal election"
replace district_name = "Passau" if district_code == 229 & election == "2021 German federal election"
replace district_name = "Rottal-Inn" if district_code == 230 & election == "2021 German federal election"
replace district_name = "Straubing" if district_code == 231 & election == "2021 German federal election"
replace district_name = "Amberg" if district_code == 232 & election == "2021 German federal election"
replace district_name = "Regensburg" if district_code == 233 & election == "2021 German federal election"
replace district_name = "Schwandorf" if district_code == 234 & election == "2021 German federal election"
replace district_name = "Weiden" if district_code == 235 & election == "2021 German federal election"
replace district_name = "Bamberg" if district_code == 236 & election == "2021 German federal election"
replace district_name = "Bayreuth" if district_code == 237 & election == "2021 German federal election"
replace district_name = "Coburg" if district_code == 238 & election == "2021 German federal election"
replace district_name = "Hof" if district_code == 239 & election == "2021 German federal election"
replace district_name = "Kulmbach" if district_code == 240 & election == "2021 German federal election"
replace district_name = "Ansbach" if district_code == 241 & election == "2021 German federal election"
replace district_name = "Erlangen" if district_code == 242 & election == "2021 German federal election"
replace district_name = "Fürth" if district_code == 243 & election == "2021 German federal election"
replace district_name = "Nürnberg-Nord" if district_code == 244 & election == "2021 German federal election"
replace district_name = "Nürnberg-Süd" if district_code == 245 & election == "2021 German federal election"
replace district_name = "Roth" if district_code == 246 & election == "2021 German federal election"
replace district_name = "Aschaffenburg" if district_code == 247 & election == "2021 German federal election"
replace district_name = "Bad Kissingen" if district_code == 248 & election == "2021 German federal election"
replace district_name = "Main-Spessart" if district_code == 249 & election == "2021 German federal election"
replace district_name = "Schweinfurt" if district_code == 250 & election == "2021 German federal election"
replace district_name = "Würzburg" if district_code == 251 & election == "2021 German federal election"
replace district_name = "Augsburg-Stadt" if district_code == 252 & election == "2021 German federal election"
replace district_name = "Augsburg-Land" if district_code == 253 & election == "2021 German federal election"
replace district_name = "Donau-Ries" if district_code == 254 & election == "2021 German federal election"
replace district_name = "Neu-Ulm" if district_code == 255 & election == "2021 German federal election"
replace district_name = "Oberallgäu" if district_code == 256 & election == "2021 German federal election"
replace district_name = "Ostallgäu" if district_code == 257 & election == "2021 German federal election"
replace district_name = "Stuttgart I" if district_code == 258 & election == "2021 German federal election"
replace district_name = "Stuttgart II" if district_code == 259 & election == "2021 German federal election"
replace district_name = "Böblingen" if district_code == 260 & election == "2021 German federal election"
replace district_name = "Esslingen" if district_code == 261 & election == "2021 German federal election"
replace district_name = "Nürtingen" if district_code == 262 & election == "2021 German federal election"
replace district_name = "Göppingen" if district_code == 263 & election == "2021 German federal election"
replace district_name = "Waiblingen" if district_code == 264 & election == "2021 German federal election"
replace district_name = "Ludwigsburg" if district_code == 265 & election == "2021 German federal election"
replace district_name = "Neckar-Zaber" if district_code == 266 & election == "2021 German federal election"
replace district_name = "Heilbronn" if district_code == 267 & election == "2021 German federal election"
replace district_name = "Schwäbisch Hall – Hohenlohe" if district_code == 268 & election == "2021 German federal election"
replace district_name = "Backnang – Schwäbisch Gmünd" if district_code == 269 & election == "2021 German federal election"
replace district_name = "Aalen – Heidenheim" if district_code == 270 & election == "2021 German federal election"
replace district_name = "Karlsruhe-Stadt" if district_code == 271 & election == "2021 German federal election"
replace district_name = "Karlsruhe-Land" if district_code == 272 & election == "2021 German federal election"
replace district_name = "Rastatt" if district_code == 273 & election == "2021 German federal election"
replace district_name = "Heidelberg" if district_code == 274 & election == "2021 German federal election"
replace district_name = "Mannheim" if district_code == 275 & election == "2021 German federal election"
replace district_name = "Odenwald – Tauber" if district_code == 276 & election == "2021 German federal election"
replace district_name = "Rhein-Neckar" if district_code == 277 & election == "2021 German federal election"
replace district_name = "Bruchsal – Schwetzingen" if district_code == 278 & election == "2021 German federal election"
replace district_name = "Pforzheim" if district_code == 279 & election == "2021 German federal election"
replace district_name = "Calw" if district_code == 280 & election == "2021 German federal election"
replace district_name = "Freiburg" if district_code == 281 & election == "2021 German federal election"
replace district_name = "Lörrach – Müllheim" if district_code == 282 & election == "2021 German federal election"
replace district_name = "Emmendingen – Lahr" if district_code == 283 & election == "2021 German federal election"
replace district_name = "Offenburg" if district_code == 284 & election == "2021 German federal election"
replace district_name = "Rottweil – Tuttlingen" if district_code == 285 & election == "2021 German federal election"
replace district_name = "Schwarzwald-Baar" if district_code == 286 & election == "2021 German federal election"
replace district_name = "Konstanz" if district_code == 287 & election == "2021 German federal election"
replace district_name = "Waldshut" if district_code == 288 & election == "2021 German federal election"
replace district_name = "Reutlingen" if district_code == 289 & election == "2021 German federal election"
replace district_name = "Tübingen" if district_code == 290 & election == "2021 German federal election"
replace district_name = "Ulm" if district_code == 291 & election == "2021 German federal election"
replace district_name = "Biberach" if district_code == 292 & election == "2021 German federal election"
replace district_name = "Bodensee" if district_code == 293 & election == "2021 German federal election"
replace district_name = "Ravensburg" if district_code == 294 & election == "2021 German federal election"
replace district_name = "Zollernalb – Sigmaringen" if district_code == 295 & election == "2021 German federal election"
replace district_name = "Saarbrücken" if district_code == 296 & election == "2021 German federal election"
replace district_name = "Saarlouis" if district_code == 297 & election == "2021 German federal election"
replace district_name = "St. Wendel" if district_code == 298 & election == "2021 German federal election"
replace district_name = "Homburg" if district_code == 299 & election == "2021 German federal election"
replace district_name = "Aoraki" if district_code == 1 & election == "2002 New Zealand general election"
replace district_name = "Auckland Central" if district_code == 2 & election == "2002 New Zealand general election"
replace district_name = "Banks Peninsula" if district_code == 3 & election == "2002 New Zealand general election"
replace district_name = "Bay of Plenty" if district_code == 4 & election == "2002 New Zealand general election"
replace district_name = "Christchurch Central" if district_code == 5 & election == "2002 New Zealand general election"
replace district_name = "Christchurch East" if district_code == 6 & election == "2002 New Zealand general election"
replace district_name = "Clevedon" if district_code == 7 & election == "2002 New Zealand general election"
replace district_name = "Clutha-Southland" if district_code == 8 & election == "2002 New Zealand general election"
replace district_name = "Coromandel" if district_code == 9 & election == "2002 New Zealand general election"
replace district_name = "Dunedin North" if district_code == 10 & election == "2002 New Zealand general election"
replace district_name = "Dunedin South" if district_code == 11 & election == "2002 New Zealand general election"
replace district_name = "East Coast" if district_code == 12 & election == "2002 New Zealand general election"
replace district_name = "East Coast Bays" if district_code == 13 & election == "2002 New Zealand general election"
replace district_name = "Epsom" if district_code == 14 & election == "2002 New Zealand general election"
replace district_name = "Hamilton East" if district_code == 15 & election == "2002 New Zealand general election"
replace district_name = "Hamilton West" if district_code == 16 & election == "2002 New Zealand general election"
replace district_name = "Helensville" if district_code == 17 & election == "2002 New Zealand general election"
replace district_name = "Hutt South" if district_code == 18 & election == "2002 New Zealand general election"
replace district_name = "Ikaroa-Rawhiti" if district_code == 19 & election == "2002 New Zealand general election"
replace district_name = "Ilam" if district_code == 20 & election == "2002 New Zealand general election"
replace district_name = "Invercargill" if district_code == 21 & election == "2002 New Zealand general election"
replace district_name = "Kaikoura" if district_code == 22 & election == "2002 New Zealand general election"
replace district_name = "Mana" if district_code == 23 & election == "2002 New Zealand general election"
replace district_name = "Mangere" if district_code == 24 & election == "2002 New Zealand general election"
replace district_name = "Manukau East" if district_code == 25 & election == "2002 New Zealand general election"
replace district_name = "Manurewa" if district_code == 26 & election == "2002 New Zealand general election"
replace district_name = "Maungakiekie" if district_code == 27 & election == "2002 New Zealand general election"
replace district_name = "Mt Albert" if district_code == 28 & election == "2002 New Zealand general election"
replace district_name = "Mt Roskill" if district_code == 29 & election == "2002 New Zealand general election"
replace district_name = "Napier" if district_code == 30 & election == "2002 New Zealand general election"
replace district_name = "Nelson" if district_code == 31 & election == "2002 New Zealand general election"
replace district_name = "New Lynn" if district_code == 32 & election == "2002 New Zealand general election"
replace district_name = "New Plymouth" if district_code == 33 & election == "2002 New Zealand general election"
replace district_name = "North Shore" if district_code == 34 & election == "2002 New Zealand general election"
replace district_name = "Northcote" if district_code == 35 & election == "2002 New Zealand general election"
replace district_name = "Northland" if district_code == 36 & election == "2002 New Zealand general election"
replace district_name = "Ohariu-Belmont" if district_code == 37 & election == "2002 New Zealand general election"
replace district_name = "Otago" if district_code == 38 & election == "2002 New Zealand general election"
replace district_name = "Otaki" if district_code == 39 & election == "2002 New Zealand general election"
replace district_name = "Pakuranga" if district_code == 40 & election == "2002 New Zealand general election"
replace district_name = "Palmerston North" if district_code == 41 & election == "2002 New Zealand general election"
replace district_name = "Piako" if district_code == 42 & election == "2002 New Zealand general election"
replace district_name = "Port Waikato" if district_code == 43 & election == "2002 New Zealand general election"
replace district_name = "Rakaia" if district_code == 44 & election == "2002 New Zealand general election"
replace district_name = "Rangitikei" if district_code == 45 & election == "2002 New Zealand general election"
replace district_name = "Rimutaka" if district_code == 46 & election == "2002 New Zealand general election"
replace district_name = "Rodney" if district_code == 47 & election == "2002 New Zealand general election"
replace district_name = "Rongotai" if district_code == 48 & election == "2002 New Zealand general election"
replace district_name = "Rotorua" if district_code == 49 & election == "2002 New Zealand general election"
replace district_name = "Tainui" if district_code == 50 & election == "2002 New Zealand general election"
replace district_name = "Tamaki" if district_code == 51 & election == "2002 New Zealand general election"
replace district_name = "Tamaki Makaurau" if district_code == 52 & election == "2002 New Zealand general election"
replace district_name = "Taranaki-King Country" if district_code == 53 & election == "2002 New Zealand general election"
replace district_name = "Taupo" if district_code == 54 & election == "2002 New Zealand general election"
replace district_name = "Tauranga" if district_code == 55 & election == "2002 New Zealand general election"
replace district_name = "Te Atatu" if district_code == 56 & election == "2002 New Zealand general election"
replace district_name = "Te Tai Hauauru" if district_code == 57 & election == "2002 New Zealand general election"
replace district_name = "Te Tai Tokerau" if district_code == 58 & election == "2002 New Zealand general election"
replace district_name = "Te Tai Tonga" if district_code == 59 & election == "2002 New Zealand general election"
replace district_name = "Tukituki" if district_code == 60 & election == "2002 New Zealand general election"
replace district_name = "Waiariki" if district_code == 61 & election == "2002 New Zealand general election"
replace district_name = "Waimakariri" if district_code == 62 & election == "2002 New Zealand general election"
replace district_name = "Wairarapa" if district_code == 63 & election == "2002 New Zealand general election"
replace district_name = "Waitakere" if district_code == 64 & election == "2002 New Zealand general election"
replace district_name = "Wellington Central" if district_code == 65 & election == "2002 New Zealand general election"
replace district_name = "West Coast-Tasman" if district_code == 66 & election == "2002 New Zealand general election"
replace district_name = "Whanganui" if district_code == 67 & election == "2002 New Zealand general election"
replace district_name = "Whangarei" if district_code == 68 & election == "2002 New Zealand general election"
replace district_name = "Wigram" if district_code == 69 & election == "2002 New Zealand general election"
replace district_name = "ALGOMA-MANITOULIN" if district_code == 1 & election == "2003 Ontario general election"
replace district_name = "BARRIE-SIMCOE-BRADFORD" if district_code == 2 & election == "2003 Ontario general election"
replace district_name = "BEACHES-EAST YORK" if district_code == 3 & election == "2003 Ontario general election"
replace district_name = "BRAMALEA-GORE-MALTON-SPRINGDALE" if district_code == 4 & election == "2003 Ontario general election"
replace district_name = "BRAMPTON CENTRE" if district_code == 5 & election == "2003 Ontario general election"
replace district_name = "BRAMPTON WEST-MISSISSAUGA" if district_code == 6 & election == "2003 Ontario general election"
replace district_name = "BRANT" if district_code == 7 & election == "2003 Ontario general election"
replace district_name = "TORONTO-DANFORTH" if district_code == 8 & election == "2003 Ontario general election"
replace district_name = "BRUCE-GREY-OWEN SOUND" if district_code == 9 & election == "2003 Ontario general election"
replace district_name = "BURLINGTON" if district_code == 10 & election == "2003 Ontario general election"
replace district_name = "CAMBRIDGE" if district_code == 11 & election == "2003 Ontario general election"
replace district_name = "DAVENPORT" if district_code == 12 & election == "2003 Ontario general election"
replace district_name = "DON VALLEY EAST" if district_code == 13 & election == "2003 Ontario general election"
replace district_name = "DON VALLEY WEST" if district_code == 14 & election == "2003 Ontario general election"
replace district_name = "DUFFERIN-PEEL-WELLINGTON-GREY" if district_code == 15 & election == "2003 Ontario general election"
replace district_name = "DURHAM" if district_code == 16 & election == "2003 Ontario general election"
replace district_name = "EGLINTON-LAWRENCE" if district_code == 17 & election == "2003 Ontario general election"
replace district_name = "ELGIN-MIDDLESEX-LONDON" if district_code == 18 & election == "2003 Ontario general election"
replace district_name = "ERIE-LINCOLN" if district_code == 19 & election == "2003 Ontario general election"
replace district_name = "ESSEX" if district_code == 20 & election == "2003 Ontario general election"
replace district_name = "ETOBICOKE CENTRE" if district_code == 21 & election == "2003 Ontario general election"
replace district_name = "ETOBICOKE-LAKESHORE" if district_code == 22 & election == "2003 Ontario general election"
replace district_name = "ETOBICOKE NORTH" if district_code == 23 & election == "2003 Ontario general election"
replace district_name = "GLENGARRY-PRESCOTT-RUSSELL" if district_code == 24 & election == "2003 Ontario general election"
replace district_name = "OTTAWA-ORLÉANS" if district_code == 25 & election == "2003 Ontario general election"
replace district_name = "GUELPH-WELLINGTON" if district_code == 26 & election == "2003 Ontario general election"
replace district_name = "HALDIMAND-NORFOLK-BRANT" if district_code == 27 & election == "2003 Ontario general election"
replace district_name = "HALTON" if district_code == 28 & election == "2003 Ontario general election"
replace district_name = "HAMILTON EAST" if district_code == 29 & election == "2003 Ontario general election"
replace district_name = "HAMILTON MOUNTAIN" if district_code == 30 & election == "2003 Ontario general election"
replace district_name = "HAMILTON WEST" if district_code == 31 & election == "2003 Ontario general election"
replace district_name = "HASTINGS-FRONTENAC-LENNOX & ADDINGTON" if district_code == 32 & election == "2003 Ontario general election"
replace district_name = "HURON-BRUCE" if district_code == 33 & election == "2003 Ontario general election"
replace district_name = "KENORA-RAINY RIVER" if district_code == 34 & election == "2003 Ontario general election"
replace district_name = "CHATHAM-KENT ESSEX" if district_code == 35 & election == "2003 Ontario general election"
replace district_name = "KINGSTON AND THE ISLANDS" if district_code == 36 & election == "2003 Ontario general election"
replace district_name = "KITCHENER CENTRE" if district_code == 37 & election == "2003 Ontario general election"
replace district_name = "KITCHENER-WATERLOO" if district_code == 38 & election == "2003 Ontario general election"
replace district_name = "LAMBTON-KENT-MIDDLESEX" if district_code == 39 & election == "2003 Ontario general election"
replace district_name = "LANARK-CARLETON" if district_code == 40 & election == "2003 Ontario general election"
replace district_name = "LEEDS-GRENVILLE" if district_code == 41 & election == "2003 Ontario general election"
replace district_name = "LONDON NORTH CENTRE" if district_code == 42 & election == "2003 Ontario general election"
replace district_name = "LONDON-FANSHAWE" if district_code == 43 & election == "2003 Ontario general election"
replace district_name = "LONDON WEST" if district_code == 44 & election == "2003 Ontario general election"
replace district_name = "MARKHAM" if district_code == 45 & election == "2003 Ontario general election"
replace district_name = "MISSISSAUGA CENTRE" if district_code == 46 & election == "2003 Ontario general election"
replace district_name = "MISSISSAUGA EAST" if district_code == 47 & election == "2003 Ontario general election"
replace district_name = "MISSISSAUGA SOUTH" if district_code == 48 & election == "2003 Ontario general election"
replace district_name = "MISSISSAUGA WEST" if district_code == 49 & election == "2003 Ontario general election"
replace district_name = "NEPEAN-CARLETON" if district_code == 50 & election == "2003 Ontario general election"
replace district_name = "NIAGARA CENTRE" if district_code == 51 & election == "2003 Ontario general election"
replace district_name = "NIAGARA FALLS" if district_code == 52 & election == "2003 Ontario general election"
replace district_name = "NICKEL BELT" if district_code == 53 & election == "2003 Ontario general election"
replace district_name = "NIPISSING" if district_code == 54 & election == "2003 Ontario general election"
replace district_name = "NORTHUMBERLAND" if district_code == 55 & election == "2003 Ontario general election"
replace district_name = "OAK RIDGES" if district_code == 56 & election == "2003 Ontario general election"
replace district_name = "OAKVILLE" if district_code == 57 & election == "2003 Ontario general election"
replace district_name = "OSHAWA" if district_code == 58 & election == "2003 Ontario general election"
replace district_name = "OTTAWA CENTRE" if district_code == 59 & election == "2003 Ontario general election"
replace district_name = "OTTAWA SOUTH" if district_code == 60 & election == "2003 Ontario general election"
replace district_name = "OTTAWA-VANIER" if district_code == 61 & election == "2003 Ontario general election"
replace district_name = "OTTAWA WEST-NEPEAN" if district_code == 62 & election == "2003 Ontario general election"
replace district_name = "OXFORD" if district_code == 63 & election == "2003 Ontario general election"
replace district_name = "PARKDALE-HIGH PARK" if district_code == 64 & election == "2003 Ontario general election"
replace district_name = "PARRY SOUND-MUSKOKA" if district_code == 65 & election == "2003 Ontario general election"
replace district_name = "PERTH-MIDDLESEX" if district_code == 66 & election == "2003 Ontario general election"
replace district_name = "PETERBOROUGH" if district_code == 67 & election == "2003 Ontario general election"
replace district_name = "PICKERING-AJAX-UXBRIDGE" if district_code == 68 & election == "2003 Ontario general election"
replace district_name = "PRINCE EDWARD-HASTINGS" if district_code == 69 & election == "2003 Ontario general election"
replace district_name = "RENFREW-NIPISSING-PEMBROKE" if district_code == 70 & election == "2003 Ontario general election"
replace district_name = "SARNIA-LAMBTON" if district_code == 71 & election == "2003 Ontario general election"
replace district_name = "SAULT STE. MARIE" if district_code == 72 & election == "2003 Ontario general election"
replace district_name = "SCARBOROUGH-AGINCOURT" if district_code == 73 & election == "2003 Ontario general election"
replace district_name = "SCARBOROUGH CENTRE" if district_code == 74 & election == "2003 Ontario general election"
replace district_name = "SCARBOROUGH EAST" if district_code == 75 & election == "2003 Ontario general election"
replace district_name = "SCARBOROUGH-ROUGE RIVER" if district_code == 76 & election == "2003 Ontario general election"
replace district_name = "SCARBOROUGH SOUTHWEST" if district_code == 77 & election == "2003 Ontario general election"
replace district_name = "SIMCOE-GREY" if district_code == 78 & election == "2003 Ontario general election"
replace district_name = "SIMCOE NORTH" if district_code == 79 & election == "2003 Ontario general election"
replace district_name = "ST. CATHARINES" if district_code == 80 & election == "2003 Ontario general election"
replace district_name = "ST. PAUL'S" if district_code == 81 & election == "2003 Ontario general election"
replace district_name = "STONEY CREEK" if district_code == 82 & election == "2003 Ontario general election"
replace district_name = "STORMONT-DUNDAS-CHARLOTTENBURGH" if district_code == 83 & election == "2003 Ontario general election"
replace district_name = "SUDBURY" if district_code == 84 & election == "2003 Ontario general election"
replace district_name = "THORNHILL" if district_code == 85 & election == "2003 Ontario general election"
replace district_name = "THUNDER BAY-ATIKOKAN" if district_code == 86 & election == "2003 Ontario general election"
replace district_name = "THUNDER BAY-SUPERIOR NORTH" if district_code == 87 & election == "2003 Ontario general election"
replace district_name = "TIMISKAMING-COCHRANE" if district_code == 88 & election == "2003 Ontario general election"
replace district_name = "TIMMINS-JAMES BAY" if district_code == 89 & election == "2003 Ontario general election"
replace district_name = "TORONTO CENTRE-ROSEDALE" if district_code == 90 & election == "2003 Ontario general election"
replace district_name = "TRINITY-SPADINA" if district_code == 91 & election == "2003 Ontario general election"
replace district_name = "VAUGHAN-KING-AURORA" if district_code == 92 & election == "2003 Ontario general election"
replace district_name = "HALIBURTON-VICTORIA-BROCK" if district_code == 93 & election == "2003 Ontario general election"
replace district_name = "WATERLOO-WELLINGTON" if district_code == 94 & election == "2003 Ontario general election"
replace district_name = "ANCASTER-DUNDAS-FLAMBOROUGH-ALDERSHOT" if district_code == 95 & election == "2003 Ontario general election"
replace district_name = "WHITBY-AJAX" if district_code == 96 & election == "2003 Ontario general election"
replace district_name = "WILLOWDALE" if district_code == 97 & election == "2003 Ontario general election"
replace district_name = "WINDSOR-ST. CLAIR" if district_code == 98 & election == "2003 Ontario general election"
replace district_name = "WINDSOR WEST" if district_code == 99 & election == "2003 Ontario general election"
replace district_name = "YORK CENTRE" if district_code == 100 & election == "2003 Ontario general election"
replace district_name = "YORK NORTH" if district_code == 101 & election == "2003 Ontario general election"
replace district_name = "YORK SOUTH-WESTON" if district_code == 102 & election == "2003 Ontario general election"
replace district_name = "YORK WEST" if district_code == 103 & election == "2003 Ontario general election"
replace district_name = "AJAX-PICKERING" if district_code == 1 & election == "2011 Ontario general election"
replace district_name = "ALGOMA-MANITOULIN" if district_code == 2 & election == "2011 Ontario general election"
replace district_name = "ANCASTER-DUNDAS-FLAMBOROUGH-WESTDALE" if district_code == 3 & election == "2011 Ontario general election"
replace district_name = "BARRIE" if district_code == 4 & election == "2011 Ontario general election"
replace district_name = "BEACHES-EAST YORK" if district_code == 5 & election == "2011 Ontario general election"
replace district_name = "BRAMALEA-GORE-MALTON" if district_code == 6 & election == "2011 Ontario general election"
replace district_name = "BRAMPTON-SPRINGDALE" if district_code == 7 & election == "2011 Ontario general election"
replace district_name = "BRAMPTON WEST" if district_code == 8 & election == "2011 Ontario general election"
replace district_name = "BRANT" if district_code == 9 & election == "2011 Ontario general election"
replace district_name = "BRUCE-GREY-OWEN SOUND" if district_code == 10 & election == "2011 Ontario general election"
replace district_name = "BURLINGTON" if district_code == 11 & election == "2011 Ontario general election"
replace district_name = "CAMBRIDGE" if district_code == 12 & election == "2011 Ontario general election"
replace district_name = "CARLETON-MISSISSIPPI MILLS" if district_code == 13 & election == "2011 Ontario general election"
replace district_name = "CHATHAM-KENT-ESSEX" if district_code == 14 & election == "2011 Ontario general election"
replace district_name = "DAVENPORT" if district_code == 15 & election == "2011 Ontario general election"
replace district_name = "DON VALLEY EAST" if district_code == 16 & election == "2011 Ontario general election"
replace district_name = "DON VALLEY WEST" if district_code == 17 & election == "2011 Ontario general election"
replace district_name = "DUFFERIN-CALEDON" if district_code == 18 & election == "2011 Ontario general election"
replace district_name = "DURHAM" if district_code == 19 & election == "2011 Ontario general election"
replace district_name = "EGLINTON-LAWRENCE" if district_code == 20 & election == "2011 Ontario general election"
replace district_name = "ELGIN-MIDDLESEX-LONDON" if district_code == 21 & election == "2011 Ontario general election"
replace district_name = "ESSEX" if district_code == 22 & election == "2011 Ontario general election"
replace district_name = "ETOBICOKE CENTRE" if district_code == 23 & election == "2011 Ontario general election"
replace district_name = "ETOBICOKE-LAKESHORE" if district_code == 24 & election == "2011 Ontario general election"
replace district_name = "ETOBICOKE NORTH" if district_code == 25 & election == "2011 Ontario general election"
replace district_name = "GLENGARRY-PRESCOTT-RUSSELL" if district_code == 26 & election == "2011 Ontario general election"
replace district_name = "GUELPH" if district_code == 27 & election == "2011 Ontario general election"
replace district_name = "HALDIMAND-NORFOLK" if district_code == 28 & election == "2011 Ontario general election"
replace district_name = "HALIBURTON-KAWARTHA LAKES-BROCK" if district_code == 29 & election == "2011 Ontario general election"
replace district_name = "HALTON" if district_code == 30 & election == "2011 Ontario general election"
replace district_name = "HAMILTON CENTRE" if district_code == 31 & election == "2011 Ontario general election"
replace district_name = "HAMILTON EAST-STONEY CREEK" if district_code == 32 & election == "2011 Ontario general election"
replace district_name = "HAMILTON MOUNTAIN" if district_code == 33 & election == "2011 Ontario general election"
replace district_name = "HURON-BRUCE" if district_code == 34 & election == "2011 Ontario general election"
replace district_name = "KENORA-RAINY RIVER" if district_code == 35 & election == "2011 Ontario general election"
replace district_name = "KINGSTON AND THE ISLANDS" if district_code == 36 & election == "2011 Ontario general election"
replace district_name = "KITCHENER CENTRE" if district_code == 37 & election == "2011 Ontario general election"
replace district_name = "KITCHENER-CONESTOGA" if district_code == 38 & election == "2011 Ontario general election"
replace district_name = "KITCHENER-WATERLOO" if district_code == 39 & election == "2011 Ontario general election"
replace district_name = "LAMBTON-KENT-MIDDLESEX" if district_code == 40 & election == "2011 Ontario general election"
replace district_name = "LANARK-FRONTENAC-LENNOX AND ADDINGTON" if district_code == 41 & election == "2011 Ontario general election"
replace district_name = "LEEDS-GRENVILLE" if district_code == 42 & election == "2011 Ontario general election"
replace district_name = "LONDON-FANSHAWE" if district_code == 43 & election == "2011 Ontario general election"
replace district_name = "LONDON NORTH CENTRE" if district_code == 44 & election == "2011 Ontario general election"
replace district_name = "LONDON WEST" if district_code == 45 & election == "2011 Ontario general election"
replace district_name = "MARKHAM-UNIONVILLE" if district_code == 46 & election == "2011 Ontario general election"
replace district_name = "MISSISSAUGA-BRAMPTON SOUTH" if district_code == 47 & election == "2011 Ontario general election"
replace district_name = "MISSISSAUGA EAST-COOKSVILLE" if district_code == 48 & election == "2011 Ontario general election"
replace district_name = "MISSISSAUGA-ERINDALE" if district_code == 49 & election == "2011 Ontario general election"
replace district_name = "MISSISSAUGA SOUTH" if district_code == 50 & election == "2011 Ontario general election"
replace district_name = "MISSISSAUGA-STREETSVILLE" if district_code == 51 & election == "2011 Ontario general election"
replace district_name = "NEPEAN-CARLETON" if district_code == 52 & election == "2011 Ontario general election"
replace district_name = "NEWMARKET-AURORA" if district_code == 53 & election == "2011 Ontario general election"
replace district_name = "NIAGARA FALLS" if district_code == 54 & election == "2011 Ontario general election"
replace district_name = "NIAGARA WEST-GLANBROOK" if district_code == 55 & election == "2011 Ontario general election"
replace district_name = "NICKEL BELT" if district_code == 56 & election == "2011 Ontario general election"
replace district_name = "NIPISSING" if district_code == 57 & election == "2011 Ontario general election"
replace district_name = "NORTHUMBERLAND-QUINTE WEST" if district_code == 58 & election == "2011 Ontario general election"
replace district_name = "OAK RIDGES-MARKHAM" if district_code == 59 & election == "2011 Ontario general election"
replace district_name = "OAKVILLE" if district_code == 60 & election == "2011 Ontario general election"
replace district_name = "OSHAWA" if district_code == 61 & election == "2011 Ontario general election"
replace district_name = "OTTAWA CENTRE" if district_code == 62 & election == "2011 Ontario general election"
replace district_name = "OTTAWA-ORLÉANS" if district_code == 63 & election == "2011 Ontario general election"
replace district_name = "OTTAWA SOUTH" if district_code == 64 & election == "2011 Ontario general election"
replace district_name = "OTTAWA-VANIER" if district_code == 65 & election == "2011 Ontario general election"
replace district_name = "OTTAWA WEST-NEPEAN" if district_code == 66 & election == "2011 Ontario general election"
replace district_name = "OXFORD" if district_code == 67 & election == "2011 Ontario general election"
replace district_name = "PARKDALE-HIGH PARK" if district_code == 68 & election == "2011 Ontario general election"
replace district_name = "PARRY SOUND-MUSKOKA" if district_code == 69 & election == "2011 Ontario general election"
replace district_name = "PERTH-WELLINGTON" if district_code == 70 & election == "2011 Ontario general election"
replace district_name = "PETERBOROUGH" if district_code == 71 & election == "2011 Ontario general election"
replace district_name = "PICKERING-SCARBOROUGH EAST" if district_code == 72 & election == "2011 Ontario general election"
replace district_name = "PRINCE EDWARD-HASTINGS" if district_code == 73 & election == "2011 Ontario general election"
replace district_name = "RENFREW-NIPISSING-PEMBROKE" if district_code == 74 & election == "2011 Ontario general election"
replace district_name = "RICHMOND HILL" if district_code == 75 & election == "2011 Ontario general election"
replace district_name = "ST. CATHARINES" if district_code == 76 & election == "2011 Ontario general election"
replace district_name = "ST. PAUL'S" if district_code == 77 & election == "2011 Ontario general election"
replace district_name = "SARNIA-LAMBTON" if district_code == 78 & election == "2011 Ontario general election"
replace district_name = "SAULT STE. MARIE" if district_code == 79 & election == "2011 Ontario general election"
replace district_name = "SCARBOROUGH-AGINCOURT" if district_code == 80 & election == "2011 Ontario general election"
replace district_name = "SCARBOROUGH CENTRE" if district_code == 81 & election == "2011 Ontario general election"
replace district_name = "SCARBOROUGH-GUILDWOOD" if district_code == 82 & election == "2011 Ontario general election"
replace district_name = "SCARBOROUGH-ROUGE RIVER" if district_code == 83 & election == "2011 Ontario general election"
replace district_name = "SCARBOROUGH SOUTHWEST" if district_code == 84 & election == "2011 Ontario general election"
replace district_name = "SIMCOE-GREY" if district_code == 85 & election == "2011 Ontario general election"
replace district_name = "SIMCOE NORTH" if district_code == 86 & election == "2011 Ontario general election"
replace district_name = "STORMONT-DUNDAS-SOUTH GLENGARRY" if district_code == 87 & election == "2011 Ontario general election"
replace district_name = "SUDBURY" if district_code == 88 & election == "2011 Ontario general election"
replace district_name = "THORNHILL" if district_code == 89 & election == "2011 Ontario general election"
replace district_name = "THUNDER BAY-ATIKOKAN" if district_code == 90 & election == "2011 Ontario general election"
replace district_name = "THUNDER BAY-SUPERIOR NORTH" if district_code == 91 & election == "2011 Ontario general election"
replace district_name = "TIMISKAMING-COCHRANE" if district_code == 92 & election == "2011 Ontario general election"
replace district_name = "TIMMINS-JAMES BAY" if district_code == 93 & election == "2011 Ontario general election"
replace district_name = "TORONTO CENTRE" if district_code == 94 & election == "2011 Ontario general election"
replace district_name = "TORONTO-DANFORTH" if district_code == 95 & election == "2011 Ontario general election"
replace district_name = "TRINITY-SPADINA" if district_code == 96 & election == "2011 Ontario general election"
replace district_name = "VAUGHAN" if district_code == 97 & election == "2011 Ontario general election"
replace district_name = "WELLAND" if district_code == 98 & election == "2011 Ontario general election"
replace district_name = "WELLINGTON-HALTON HILLS" if district_code == 99 & election == "2011 Ontario general election"
replace district_name = "WHITBY-OSHAWA" if district_code == 100 & election == "2011 Ontario general election"
replace district_name = "WILLOWDALE" if district_code == 101 & election == "2011 Ontario general election"
replace district_name = "WINDSOR-TECUMSEH" if district_code == 102 & election == "2011 Ontario general election"
replace district_name = "WINDSOR WEST" if district_code == 103 & election == "2011 Ontario general election"
replace district_name = "YORK CENTRE" if district_code == 104 & election == "2011 Ontario general election"
replace district_name = "YORK-SIMCOE" if district_code == 105 & election == "2011 Ontario general election"
replace district_name = "YORK SOUTH-WESTON" if district_code == 106 & election == "2011 Ontario general election"
replace district_name = "YORK WEST" if district_code == 107 & election == "2011 Ontario general election"
replace district_name = "AJAX-PICKERING" if district_code == 1 & election == "2014 Ontario general election"
replace district_name = "ALGOMA-MANITOULIN" if district_code == 2 & election == "2014 Ontario general election"
replace district_name = "ANCASTER-DUNDAS-FLAMBOROUGH-WESTDALE" if district_code == 3 & election == "2014 Ontario general election"
replace district_name = "BARRIE" if district_code == 4 & election == "2014 Ontario general election"
replace district_name = "BEACHES-EAST YORK" if district_code == 5 & election == "2014 Ontario general election"
replace district_name = "BRAMALEA-GORE-MALTON" if district_code == 6 & election == "2014 Ontario general election"
replace district_name = "BRAMPTON-SPRINGDALE" if district_code == 7 & election == "2014 Ontario general election"
replace district_name = "BRAMPTON WEST" if district_code == 8 & election == "2014 Ontario general election"
replace district_name = "BRANT" if district_code == 9 & election == "2014 Ontario general election"
replace district_name = "BRUCE-GREY-OWEN SOUND" if district_code == 10 & election == "2014 Ontario general election"
replace district_name = "BURLINGTON" if district_code == 11 & election == "2014 Ontario general election"
replace district_name = "CAMBRIDGE" if district_code == 12 & election == "2014 Ontario general election"
replace district_name = "CARLETON-MISSISSIPPI MILLS" if district_code == 13 & election == "2014 Ontario general election"
replace district_name = "CHATHAM-KENT-ESSEX" if district_code == 14 & election == "2014 Ontario general election"
replace district_name = "DAVENPORT" if district_code == 15 & election == "2014 Ontario general election"
replace district_name = "DON VALLEY EAST" if district_code == 16 & election == "2014 Ontario general election"
replace district_name = "DON VALLEY WEST" if district_code == 17 & election == "2014 Ontario general election"
replace district_name = "DUFFERIN-CALEDON" if district_code == 18 & election == "2014 Ontario general election"
replace district_name = "DURHAM" if district_code == 19 & election == "2014 Ontario general election"
replace district_name = "EGLINTON-LAWRENCE" if district_code == 20 & election == "2014 Ontario general election"
replace district_name = "ELGIN-MIDDLESEX-LONDON" if district_code == 21 & election == "2014 Ontario general election"
replace district_name = "ESSEX" if district_code == 22 & election == "2014 Ontario general election"
replace district_name = "ETOBICOKE CENTRE" if district_code == 23 & election == "2014 Ontario general election"
replace district_name = "ETOBICOKE-LAKESHORE" if district_code == 24 & election == "2014 Ontario general election"
replace district_name = "ETOBICOKE NORTH" if district_code == 25 & election == "2014 Ontario general election"
replace district_name = "GLENGARRY-PRESCOTT-RUSSELL" if district_code == 26 & election == "2014 Ontario general election"
replace district_name = "GUELPH" if district_code == 27 & election == "2014 Ontario general election"
replace district_name = "HALDIMAND-NORFOLK" if district_code == 28 & election == "2014 Ontario general election"
replace district_name = "HALIBURTON-KAWARTHA LAKES-BROCK" if district_code == 29 & election == "2014 Ontario general election"
replace district_name = "HALTON" if district_code == 30 & election == "2014 Ontario general election"
replace district_name = "HAMILTON CENTRE" if district_code == 31 & election == "2014 Ontario general election"
replace district_name = "HAMILTON EAST-STONEY CREEK" if district_code == 32 & election == "2014 Ontario general election"
replace district_name = "HAMILTON MOUNTAIN" if district_code == 33 & election == "2014 Ontario general election"
replace district_name = "HURON-BRUCE" if district_code == 34 & election == "2014 Ontario general election"
replace district_name = "KENORA-RAINY RIVER" if district_code == 35 & election == "2014 Ontario general election"
replace district_name = "KINGSTON AND THE ISLANDS" if district_code == 36 & election == "2014 Ontario general election"
replace district_name = "KITCHENER CENTRE" if district_code == 37 & election == "2014 Ontario general election"
replace district_name = "KITCHENER-CONESTOGA" if district_code == 38 & election == "2014 Ontario general election"
replace district_name = "KITCHENER-WATERLOO" if district_code == 39 & election == "2014 Ontario general election"
replace district_name = "LAMBTON-KENT-MIDDLESEX" if district_code == 40 & election == "2014 Ontario general election"
replace district_name = "LANARK-FRONTENAC-LENNOX AND ADDINGTON" if district_code == 41 & election == "2014 Ontario general election"
replace district_name = "LEEDS-GRENVILLE" if district_code == 42 & election == "2014 Ontario general election"
replace district_name = "LONDON-FANSHAWE" if district_code == 43 & election == "2014 Ontario general election"
replace district_name = "LONDON NORTH CENTRE" if district_code == 44 & election == "2014 Ontario general election"
replace district_name = "LONDON WEST" if district_code == 45 & election == "2014 Ontario general election"
replace district_name = "MARKHAM-UNIONVILLE" if district_code == 46 & election == "2014 Ontario general election"
replace district_name = "MISSISSAUGA-BRAMPTON SOUTH" if district_code == 47 & election == "2014 Ontario general election"
replace district_name = "MISSISSAUGA EAST-COOKSVILLE" if district_code == 48 & election == "2014 Ontario general election"
replace district_name = "MISSISSAUGA-ERINDALE" if district_code == 49 & election == "2014 Ontario general election"
replace district_name = "MISSISSAUGA SOUTH" if district_code == 50 & election == "2014 Ontario general election"
replace district_name = "MISSISSAUGA-STREETSVILLE" if district_code == 51 & election == "2014 Ontario general election"
replace district_name = "NEPEAN-CARLETON" if district_code == 52 & election == "2014 Ontario general election"
replace district_name = "NEWMARKET-AURORA" if district_code == 53 & election == "2014 Ontario general election"
replace district_name = "NIAGARA FALLS" if district_code == 54 & election == "2014 Ontario general election"
replace district_name = "NIAGARA WEST-GLANBROOK" if district_code == 55 & election == "2014 Ontario general election"
replace district_name = "NICKEL BELT" if district_code == 56 & election == "2014 Ontario general election"
replace district_name = "NIPISSING" if district_code == 57 & election == "2014 Ontario general election"
replace district_name = "NORTHUMBERLAND-QUINTE WEST" if district_code == 58 & election == "2014 Ontario general election"
replace district_name = "OAK RIDGES-MARKHAM" if district_code == 59 & election == "2014 Ontario general election"
replace district_name = "OAKVILLE" if district_code == 60 & election == "2014 Ontario general election"
replace district_name = "OSHAWA" if district_code == 61 & election == "2014 Ontario general election"
replace district_name = "OTTAWA CENTRE" if district_code == 62 & election == "2014 Ontario general election"
replace district_name = "OTTAWA-ORLÉANS" if district_code == 63 & election == "2014 Ontario general election"
replace district_name = "OTTAWA SOUTH" if district_code == 64 & election == "2014 Ontario general election"
replace district_name = "OTTAWA-VANIER" if district_code == 65 & election == "2014 Ontario general election"
replace district_name = "OTTAWA WEST-NEPEAN" if district_code == 66 & election == "2014 Ontario general election"
replace district_name = "OXFORD" if district_code == 67 & election == "2014 Ontario general election"
replace district_name = "PARKDALE-HIGH PARK" if district_code == 68 & election == "2014 Ontario general election"
replace district_name = "PARRY SOUND-MUSKOKA" if district_code == 69 & election == "2014 Ontario general election"
replace district_name = "PERTH-WELLINGTON" if district_code == 70 & election == "2014 Ontario general election"
replace district_name = "PETERBOROUGH" if district_code == 71 & election == "2014 Ontario general election"
replace district_name = "PICKERING-SCARBOROUGH EAST" if district_code == 72 & election == "2014 Ontario general election"
replace district_name = "PRINCE EDWARD-HASTINGS" if district_code == 73 & election == "2014 Ontario general election"
replace district_name = "RENFREW-NIPISSING-PEMBROKE" if district_code == 74 & election == "2014 Ontario general election"
replace district_name = "RICHMOND HILL" if district_code == 75 & election == "2014 Ontario general election"
replace district_name = "ST. CATHARINES" if district_code == 76 & election == "2014 Ontario general election"
replace district_name = "ST. PAUL'S" if district_code == 77 & election == "2014 Ontario general election"
replace district_name = "SARNIA-LAMBTON" if district_code == 78 & election == "2014 Ontario general election"
replace district_name = "SAULT STE. MARIE" if district_code == 79 & election == "2014 Ontario general election"
replace district_name = "SCARBOROUGH-AGINCOURT" if district_code == 80 & election == "2014 Ontario general election"
replace district_name = "SCARBOROUGH CENTRE" if district_code == 81 & election == "2014 Ontario general election"
replace district_name = "SCARBOROUGH-GUILDWOOD" if district_code == 82 & election == "2014 Ontario general election"
replace district_name = "SCARBOROUGH-ROUGE RIVER" if district_code == 83 & election == "2014 Ontario general election"
replace district_name = "SCARBOROUGH SOUTHWEST" if district_code == 84 & election == "2014 Ontario general election"
replace district_name = "SIMCOE-GREY" if district_code == 85 & election == "2014 Ontario general election"
replace district_name = "SIMCOE NORTH" if district_code == 86 & election == "2014 Ontario general election"
replace district_name = "STORMONT-DUNDAS-SOUTH GLENGARRY" if district_code == 87 & election == "2014 Ontario general election"
replace district_name = "SUDBURY" if district_code == 88 & election == "2014 Ontario general election"
replace district_name = "THORNHILL" if district_code == 89 & election == "2014 Ontario general election"
replace district_name = "THUNDER BAY-ATIKOKAN" if district_code == 90 & election == "2014 Ontario general election"
replace district_name = "THUNDER BAY-SUPERIOR NORTH" if district_code == 91 & election == "2014 Ontario general election"
replace district_name = "TIMISKAMING-COCHRANE" if district_code == 92 & election == "2014 Ontario general election"
replace district_name = "TIMMINS-JAMES BAY" if district_code == 93 & election == "2014 Ontario general election"
replace district_name = "TORONTO CENTRE" if district_code == 94 & election == "2014 Ontario general election"
replace district_name = "TORONTO-DANFORTH" if district_code == 95 & election == "2014 Ontario general election"
replace district_name = "TRINITY-SPADINA" if district_code == 96 & election == "2014 Ontario general election"
replace district_name = "VAUGHAN" if district_code == 97 & election == "2014 Ontario general election"
replace district_name = "WELLAND" if district_code == 98 & election == "2014 Ontario general election"
replace district_name = "WELLINGTON-HALTON HILLS" if district_code == 99 & election == "2014 Ontario general election"
replace district_name = "WHITBY-OSHAWA" if district_code == 100 & election == "2014 Ontario general election"
replace district_name = "WILLOWDALE" if district_code == 101 & election == "2014 Ontario general election"
replace district_name = "WINDSOR-TECUMSEH" if district_code == 102 & election == "2014 Ontario general election"
replace district_name = "WINDSOR WEST" if district_code == 103 & election == "2014 Ontario general election"
replace district_name = "YORK CENTRE" if district_code == 104 & election == "2014 Ontario general election"
replace district_name = "YORK-SIMCOE" if district_code == 105 & election == "2014 Ontario general election"
replace district_name = "YORK SOUTH-WESTON" if district_code == 106 & election == "2014 Ontario general election"
replace district_name = "YORK WEST" if district_code == 107 & election == "2014 Ontario general election"
replace district_name = "BEDFORD" if district_code == 1 & election == "2005 British general election"
replace district_name = "READING EAST" if district_code == 10 & election == "2005 British general election"
replace district_name = "EPSOM & EWELL" if district_code == 100 & election == "2005 British general election"
replace district_name = "ESHER & WALTON" if district_code == 101 & election == "2005 British general election"
replace district_name = "GUILDFORD" if district_code == 102 & election == "2005 British general election"
replace district_name = "MOLE VALLEY" if district_code == 103 & election == "2005 British general election"
replace district_name = "REIGATE" if district_code == 104 & election == "2005 British general election"
replace district_name = "RUNNYMEDE & WEYBRIDGE" if district_code == 105 & election == "2005 British general election"
replace district_name = "SURREY SOUTH WEST" if district_code == 106 & election == "2005 British general election"
replace district_name = "SPELTHORNE" if district_code == 107 & election == "2005 British general election"
replace district_name = "SURREY HEATH" if district_code == 108 & election == "2005 British general election"
replace district_name = "WOKING" if district_code == 109 & election == "2005 British general election"
replace district_name = "READING WEST" if district_code == 11 & election == "2005 British general election"
replace district_name = "ARUNDEL & SOUTH DOWNS" if district_code == 110 & election == "2005 British general election"
replace district_name = "BOGNOR REGIS & LITTLEHAMPTON" if district_code == 111 & election == "2005 British general election"
replace district_name = "CHICHESTER" if district_code == 112 & election == "2005 British general election"
replace district_name = "CRAWLEY" if district_code == 113 & election == "2005 British general election"
replace district_name = "EAST WORTHING & SHOREHAM" if district_code == 114 & election == "2005 British general election"
replace district_name = "HORSHAM" if district_code == 115 & election == "2005 British general election"
replace district_name = "MID SUSSEX" if district_code == 116 & election == "2005 British general election"
replace district_name = "WORTHING WEST" if district_code == 117 & election == "2005 British general election"
replace district_name = "CAMBRIDGE" if district_code == 118 & election == "2005 British general election"
replace district_name = "HUNTINGDON" if district_code == 119 & election == "2005 British general election"
replace district_name = "SLOUGH" if district_code == 12 & election == "2005 British general election"
replace district_name = "NORTH EAST CAMBRIDGESHIRE" if district_code == 120 & election == "2005 British general election"
replace district_name = "NORTH WEST CAMBRIDGESHIRE" if district_code == 121 & election == "2005 British general election"
replace district_name = "PETERBOROUGH" if district_code == 122 & election == "2005 British general election"
replace district_name = "SOUTH CAMBRIDGESHIRE" if district_code == 123 & election == "2005 British general election"
replace district_name = "SOUTH EAST CAMBRIDGESHIRE" if district_code == 124 & election == "2005 British general election"
replace district_name = "GREAT YARMOUTH" if district_code == 125 & election == "2005 British general election"
replace district_name = "MID NORFOLK" if district_code == 126 & election == "2005 British general election"
replace district_name = "NORTH NORFOLK" if district_code == 127 & election == "2005 British general election"
replace district_name = "NORFOLK NORTH WEST" if district_code == 128 & election == "2005 British general election"
replace district_name = "NORWICH NORTH" if district_code == 129 & election == "2005 British general election"
replace district_name = "WINDSOR" if district_code == 13 & election == "2005 British general election"
replace district_name = "NORWICH SOUTH" if district_code == 130 & election == "2005 British general election"
replace district_name = "SOUTH NORFOLK" if district_code == 131 & election == "2005 British general election"
replace district_name = "NORFOLK SOUTH WEST" if district_code == 132 & election == "2005 British general election"
replace district_name = "BURY ST EDMUNDS" if district_code == 133 & election == "2005 British general election"
replace district_name = "CENTRAL SUFFOLK & NORTH IPSWICH" if district_code == 134 & election == "2005 British general election"
replace district_name = "IPSWICH" if district_code == 135 & election == "2005 British general election"
replace district_name = "SOUTH SUFFOLK" if district_code == 136 & election == "2005 British general election"
replace district_name = "SUFFOLK COASTAL" if district_code == 137 & election == "2005 British general election"
replace district_name = "WAVENEY" if district_code == 138 & election == "2005 British general election"
replace district_name = "WEST SUFFOLK" if district_code == 139 & election == "2005 British general election"
replace district_name = "WOKINGHAM" if district_code == 14 & election == "2005 British general election"
replace district_name = "BARKING" if district_code == 140 & election == "2005 British general election"
replace district_name = "BATTERSEA" if district_code == 141 & election == "2005 British general election"
replace district_name = "BECKENHAM" if district_code == 142 & election == "2005 British general election"
replace district_name = "BETHNAL GREEN & BOW" if district_code == 143 & election == "2005 British general election"
replace district_name = "BEXLEYHEATH & CRAYFORD" if district_code == 144 & election == "2005 British general election"
replace district_name = "BRENT EAST" if district_code == 145 & election == "2005 British general election"
replace district_name = "BRENT NORTH" if district_code == 146 & election == "2005 British general election"
replace district_name = "BRENT SOUTH" if district_code == 147 & election == "2005 British general election"
replace district_name = "BRENTFORD & ISLEWORTH" if district_code == 148 & election == "2005 British general election"
replace district_name = "BROMLEY & CHISLEHURST" if district_code == 149 & election == "2005 British general election"
replace district_name = "AYLESBURY" if district_code == 15 & election == "2005 British general election"
replace district_name = "CAMBERWELL & PECKHAM" if district_code == 150 & election == "2005 British general election"
replace district_name = "CARSHALTON & WALLINGTON" if district_code == 151 & election == "2005 British general election"
replace district_name = "CHINGFORD & WOODFORD GREEN" if district_code == 152 & election == "2005 British general election"
replace district_name = "CHIPPING BARNET" if district_code == 153 & election == "2005 British general election"
replace district_name = "CITIES OF LONDON & WESTMINSTER" if district_code == 154 & election == "2005 British general election"
replace district_name = "CROYDON CENTRAL" if district_code == 155 & election == "2005 British general election"
replace district_name = "CROYDON NORTH" if district_code == 156 & election == "2005 British general election"
replace district_name = "CROYDON SOUTH" if district_code == 157 & election == "2005 British general election"
replace district_name = "DAGENHAM" if district_code == 158 & election == "2005 British general election"
replace district_name = "DULWICH & WEST NORWOOD" if district_code == 159 & election == "2005 British general election"
replace district_name = "BEACONSFIELD" if district_code == 16 & election == "2005 British general election"
replace district_name = "EALING, SOUTHALL" if district_code == 160 & election == "2005 British general election"
replace district_name = "EALING NORTH" if district_code == 161 & election == "2005 British general election"
replace district_name = "EALING, ACTON & SHEPHERD'S BUSH" if district_code == 162 & election == "2005 British general election"
replace district_name = "EAST HAM" if district_code == 163 & election == "2005 British general election"
replace district_name = "EDMONTON" if district_code == 164 & election == "2005 British general election"
replace district_name = "ELTHAM" if district_code == 165 & election == "2005 British general election"
replace district_name = "ENFIELD NORTH" if district_code == 166 & election == "2005 British general election"
replace district_name = "ENFIELD, SOUTHGATE" if district_code == 167 & election == "2005 British general election"
replace district_name = "ERITH & THAMESMEAD" if district_code == 168 & election == "2005 British general election"
replace district_name = "FELTHAM & HESTON" if district_code == 169 & election == "2005 British general election"
replace district_name = "BUCKINGHAM" if district_code == 17 & election == "2005 British general election"
replace district_name = "FINCHLEY & GOLDERS GREEN" if district_code == 170 & election == "2005 British general election"
replace district_name = "GREENWICH & WOOLWICH" if district_code == 171 & election == "2005 British general election"
replace district_name = "HACKNEY NORTH & STOKE NEWINGTON" if district_code == 172 & election == "2005 British general election"
replace district_name = "HACKNEY SOUTH & SHOREDITCH" if district_code == 173 & election == "2005 British general election"
replace district_name = "HAMMERSMITH & FULHAM" if district_code == 174 & election == "2005 British general election"
replace district_name = "HAMPSTEAD & HIGHGATE" if district_code == 175 & election == "2005 British general election"
replace district_name = "HARROW EAST" if district_code == 176 & election == "2005 British general election"
replace district_name = "HARROW WEST" if district_code == 177 & election == "2005 British general election"
replace district_name = "HAYES & HARLINGTON" if district_code == 178 & election == "2005 British general election"
replace district_name = "HENDON" if district_code == 179 & election == "2005 British general election"
replace district_name = "CHESHAM & AMERSHAM" if district_code == 18 & election == "2005 British general election"
replace district_name = "HOLBORN & ST PANCRAS" if district_code == 180 & election == "2005 British general election"
replace district_name = "HORNCHURCH" if district_code == 181 & election == "2005 British general election"
replace district_name = "HORNSEY & WOOD GREEN" if district_code == 182 & election == "2005 British general election"
replace district_name = "ILFORD NORTH" if district_code == 183 & election == "2005 British general election"
replace district_name = "ILFORD SOUTH" if district_code == 184 & election == "2005 British general election"
replace district_name = "ISLINGTON NORTH" if district_code == 185 & election == "2005 British general election"
replace district_name = "ISLINGTON SOUTH & FINSBURY" if district_code == 186 & election == "2005 British general election"
replace district_name = "KENSINGTON & CHELSEA" if district_code == 187 & election == "2005 British general election"
replace district_name = "KINGSTON & SURBITON" if district_code == 188 & election == "2005 British general election"
replace district_name = "LEWISHAM EAST" if district_code == 189 & election == "2005 British general election"
replace district_name = "MILTON KEYNES SOUTH WEST" if district_code == 19 & election == "2005 British general election"
replace district_name = "LEWISHAM WEST" if district_code == 190 & election == "2005 British general election"
replace district_name = "LEWISHAM, DEPTFORD" if district_code == 191 & election == "2005 British general election"
replace district_name = "LEYTON & WANSTEAD" if district_code == 192 & election == "2005 British general election"
replace district_name = "MITCHAM & MORDEN" if district_code == 193 & election == "2005 British general election"
replace district_name = "SOUTHWARK NORTH & BERMONDSEY" if district_code == 194 & election == "2005 British general election"
replace district_name = "OLD BEXLEY & SIDCUP" if district_code == 195 & election == "2005 British general election"
replace district_name = "ORPINGTON" if district_code == 196 & election == "2005 British general election"
replace district_name = "POPLAR & CANNING TOWN" if district_code == 197 & election == "2005 British general election"
replace district_name = "PUTNEY" if district_code == 198 & election == "2005 British general election"
replace district_name = "REGENT'S PARK & KENSINGTON NORTH" if district_code == 199 & election == "2005 British general election"
replace district_name = "LUTON NORTH" if district_code == 2 & election == "2005 British general election"
replace district_name = "NORTH EAST MILTON KEYNES" if district_code == 20 & election == "2005 British general election"
replace district_name = "RICHMOND PARK" if district_code == 200 & election == "2005 British general election"
replace district_name = "ROMFORD" if district_code == 201 & election == "2005 British general election"
replace district_name = "RUISLIP - NORTHWOOD" if district_code == 202 & election == "2005 British general election"
replace district_name = "STREATHAM" if district_code == 203 & election == "2005 British general election"
replace district_name = "SUTTON & CHEAM" if district_code == 204 & election == "2005 British general election"
replace district_name = "TOOTING" if district_code == 205 & election == "2005 British general election"
replace district_name = "TOTTENHAM" if district_code == 206 & election == "2005 British general election"
replace district_name = "TWICKENHAM" if district_code == 207 & election == "2005 British general election"
replace district_name = "UPMINSTER" if district_code == 208 & election == "2005 British general election"
replace district_name = "UXBRIDGE" if district_code == 209 & election == "2005 British general election"
replace district_name = "WYCOMBE" if district_code == 21 & election == "2005 British general election"
replace district_name = "VAUXHALL" if district_code == 210 & election == "2005 British general election"
replace district_name = "WALTHAMSTOW" if district_code == 211 & election == "2005 British general election"
replace district_name = "WEST HAM" if district_code == 212 & election == "2005 British general election"
replace district_name = "WIMBLEDON" if district_code == 213 & election == "2005 British general election"
replace district_name = "BATH" if district_code == 214 & election == "2005 British general election"
replace district_name = "BRISTOL EAST" if district_code == 215 & election == "2005 British general election"
replace district_name = "BRISTOL NORTH WEST" if district_code == 216 & election == "2005 British general election"
replace district_name = "BRISTOL SOUTH" if district_code == 217 & election == "2005 British general election"
replace district_name = "BRISTOL WEST" if district_code == 218 & election == "2005 British general election"
replace district_name = "KINGSWOOD" if district_code == 219 & election == "2005 British general election"
replace district_name = "BEXHILL & BATTLE" if district_code == 22 & election == "2005 British general election"
replace district_name = "NORTHAVON" if district_code == 220 & election == "2005 British general election"
replace district_name = "WANSDYKE" if district_code == 221 & election == "2005 British general election"
replace district_name = "WESTON-SUPER-MARE" if district_code == 222 & election == "2005 British general election"
replace district_name = "WOODSPRING" if district_code == 223 & election == "2005 British general election"
replace district_name = "FALMOUTH & CAMBORNE" if district_code == 224 & election == "2005 British general election"
replace district_name = "CORNWALL NORTH" if district_code == 225 & election == "2005 British general election"
replace district_name = "SOUTH EAST CORNWALL" if district_code == 226 & election == "2005 British general election"
replace district_name = "ST IVES" if district_code == 227 & election == "2005 British general election"
replace district_name = "TRURO & ST AUSTELL" if district_code == 228 & election == "2005 British general election"
replace district_name = "EAST DEVON" if district_code == 229 & election == "2005 British general election"
replace district_name = "BRIGHTON, KEMPTOWN" if district_code == 23 & election == "2005 British general election"
replace district_name = "EXETER" if district_code == 230 & election == "2005 British general election"
replace district_name = "NORTH DEVON" if district_code == 231 & election == "2005 British general election"
replace district_name = "PLYMOUTH, DEVONPORT" if district_code == 232 & election == "2005 British general election"
replace district_name = "PLYMOUTH, SUTTON" if district_code == 233 & election == "2005 British general election"
replace district_name = "SOUTH WEST DEVON" if district_code == 234 & election == "2005 British general election"
replace district_name = "TEIGNBRIDGE" if district_code == 235 & election == "2005 British general election"
replace district_name = "TIVERTON & HONITON" if district_code == 236 & election == "2005 British general election"
replace district_name = "TORBAY" if district_code == 237 & election == "2005 British general election"
replace district_name = "TORRIDGE & WEST DEVON" if district_code == 238 & election == "2005 British general election"
replace district_name = "TOTNES" if district_code == 239 & election == "2005 British general election"
replace district_name = "BRIGHTON, PAVILION" if district_code == 24 & election == "2005 British general election"
replace district_name = "BOURNEMOUTH EAST" if district_code == 240 & election == "2005 British general election"
replace district_name = "BOURNEMOUTH WEST" if district_code == 241 & election == "2005 British general election"
replace district_name = "CHRISTCHURCH" if district_code == 242 & election == "2005 British general election"
replace district_name = "MID DORSET & NORTH POOLE" if district_code == 243 & election == "2005 British general election"
replace district_name = "NORTH DORSET" if district_code == 244 & election == "2005 British general election"
replace district_name = "POOLE" if district_code == 245 & election == "2005 British general election"
replace district_name = "SOUTH DORSET" if district_code == 246 & election == "2005 British general election"
replace district_name = "DORSET WEST" if district_code == 247 & election == "2005 British general election"
replace district_name = "CHELTENHAM" if district_code == 248 & election == "2005 British general election"
replace district_name = "COTSWOLD" if district_code == 249 & election == "2005 British general election"
replace district_name = "EASTBOURNE" if district_code == 25 & election == "2005 British general election"
replace district_name = "FOREST OF DEAN" if district_code == 250 & election == "2005 British general election"
replace district_name = "GLOUCESTER" if district_code == 251 & election == "2005 British general election"
replace district_name = "STROUD" if district_code == 252 & election == "2005 British general election"
replace district_name = "TEWKESBURY" if district_code == 253 & election == "2005 British general election"
replace district_name = "BRIDGWATER" if district_code == 254 & election == "2005 British general election"
replace district_name = "SOMERTON & FROME" if district_code == 255 & election == "2005 British general election"
replace district_name = "TAUNTON" if district_code == 256 & election == "2005 British general election"
replace district_name = "WELLS" if district_code == 257 & election == "2005 British general election"
replace district_name = "YEOVIL" if district_code == 258 & election == "2005 British general election"
replace district_name = "DEVIZES" if district_code == 259 & election == "2005 British general election"
replace district_name = "HASTINGS & RYE" if district_code == 26 & election == "2005 British general election"
replace district_name = "SWINDON NORTH" if district_code == 260 & election == "2005 British general election"
replace district_name = "NORTH WILTSHIRE" if district_code == 261 & election == "2005 British general election"
replace district_name = "SALISBURY" if district_code == 262 & election == "2005 British general election"
replace district_name = "SOUTH SWINDON" if district_code == 263 & election == "2005 British general election"
replace district_name = "WESTBURY" if district_code == 264 & election == "2005 British general election"
replace district_name = "BROMSGROVE" if district_code == 265 & election == "2005 British general election"
replace district_name = "HEREFORD" if district_code == 266 & election == "2005 British general election"
replace district_name = "LEOMINSTER" if district_code == 267 & election == "2005 British general election"
replace district_name = "MID WORCESTERSHIRE" if district_code == 268 & election == "2005 British general election"
replace district_name = "REDDITCH" if district_code == 269 & election == "2005 British general election"
replace district_name = "HOVE" if district_code == 27 & election == "2005 British general election"
replace district_name = "WEST WORCESTERSHIRE" if district_code == 270 & election == "2005 British general election"
replace district_name = "WORCESTER" if district_code == 271 & election == "2005 British general election"
replace district_name = "WYRE FOREST" if district_code == 272 & election == "2005 British general election"
replace district_name = "LUDLOW" if district_code == 273 & election == "2005 British general election"
replace district_name = "NORTH SHROPSHIRE" if district_code == 274 & election == "2005 British general election"
replace district_name = "SHREWSBURY & ATCHAM" if district_code == 275 & election == "2005 British general election"
replace district_name = "TELFORD" if district_code == 276 & election == "2005 British general election"
replace district_name = "WREKIN, THE" if district_code == 277 & election == "2005 British general election"
replace district_name = "BURTON" if district_code == 278 & election == "2005 British general election"
replace district_name = "CANNOCK CHASE" if district_code == 279 & election == "2005 British general election"
replace district_name = "LEWES" if district_code == 28 & election == "2005 British general election"
replace district_name = "LICHFIELD" if district_code == 280 & election == "2005 British general election"
replace district_name = "NEWCASTLE-UNDER-LYME" if district_code == 281 & election == "2005 British general election"
replace district_name = "SOUTH STAFFORDSHIRE" if district_code == 282 & election == "2005 British general election"
replace district_name = "STAFFORD" if district_code == 283 & election == "2005 British general election"
replace district_name = "STAFFORDSHIRE MOORLANDS" if district_code == 284 & election == "2005 British general election"
replace district_name = "STOKE-ON-TRENT CENTRAL" if district_code == 285 & election == "2005 British general election"
replace district_name = "STOKE-ON-TRENT NORTH" if district_code == 286 & election == "2005 British general election"
replace district_name = "STOKE-ON-TRENT SOUTH" if district_code == 287 & election == "2005 British general election"
replace district_name = "STONE" if district_code == 288 & election == "2005 British general election"
replace district_name = "TAMWORTH" if district_code == 289 & election == "2005 British general election"
replace district_name = "WEALDEN" if district_code == 29 & election == "2005 British general election"
replace district_name = "NORTH WARWICKSHIRE" if district_code == 290 & election == "2005 British general election"
replace district_name = "NUNEATON" if district_code == 291 & election == "2005 British general election"
replace district_name = "RUGBY & KENILWORTH" if district_code == 292 & election == "2005 British general election"
replace district_name = "STRATFORD ON AVON" if district_code == 293 & election == "2005 British general election"
replace district_name = "WARWICK & LEAMINGTON" if district_code == 294 & election == "2005 British general election"
replace district_name = "ALDRIDGE - BROWNHILLS" if district_code == 295 & election == "2005 British general election"
replace district_name = "BIRMINGHAM, EDGBASTON" if district_code == 296 & election == "2005 British general election"
replace district_name = "BIRMINGHAM, ERDINGTON" if district_code == 297 & election == "2005 British general election"
replace district_name = "BIRMINGHAM, HALL GREEN" if district_code == 298 & election == "2005 British general election"
replace district_name = "BIRMINGHAM, HODGE HILL" if district_code == 299 & election == "2005 British general election"
replace district_name = "LUTON SOUTH" if district_code == 3 & election == "2005 British general election"
replace district_name = "BASILDON" if district_code == 30 & election == "2005 British general election"
replace district_name = "BIRMINGHAM, LADYWOOD" if district_code == 300 & election == "2005 British general election"
replace district_name = "BIRMINGHAM, NORTHFIELD" if district_code == 301 & election == "2005 British general election"
replace district_name = "BIRMINGHAM, PERRY BARR" if district_code == 302 & election == "2005 British general election"
replace district_name = "BIRMINGHAM, SELLY OAK" if district_code == 303 & election == "2005 British general election"
replace district_name = "BIRMINGHAM, SPARKBROOK & SMALL HEATH" if district_code == 304 & election == "2005 British general election"
replace district_name = "BIRMINGHAM, YARDLEY" if district_code == 305 & election == "2005 British general election"
replace district_name = "COVENTRY NORTH EAST" if district_code == 306 & election == "2005 British general election"
replace district_name = "COVENTRY NORTH WEST" if district_code == 307 & election == "2005 British general election"
replace district_name = "COVENTRY SOUTH" if district_code == 308 & election == "2005 British general election"
replace district_name = "DUDLEY NORTH" if district_code == 309 & election == "2005 British general election"
replace district_name = "BILLERICAY" if district_code == 31 & election == "2005 British general election"
replace district_name = "DUDLEY SOUTH" if district_code == 310 & election == "2005 British general election"
replace district_name = "HALESOWEN & ROWLEY REGIS" if district_code == 311 & election == "2005 British general election"
replace district_name = "MERIDEN" if district_code == 312 & election == "2005 British general election"
replace district_name = "SOLIHULL" if district_code == 313 & election == "2005 British general election"
replace district_name = "STOURBRIDGE" if district_code == 314 & election == "2005 British general election"
replace district_name = "SUTTON COLDFIELD" if district_code == 315 & election == "2005 British general election"
replace district_name = "WALSALL NORTH" if district_code == 316 & election == "2005 British general election"
replace district_name = "WALSALL SOUTH" if district_code == 317 & election == "2005 British general election"
replace district_name = "WARLEY" if district_code == 318 & election == "2005 British general election"
replace district_name = "WEST BROMWICH EAST" if district_code == 319 & election == "2005 British general election"
replace district_name = "BRAINTREE" if district_code == 32 & election == "2005 British general election"
replace district_name = "WEST BROMWICH WEST" if district_code == 320 & election == "2005 British general election"
replace district_name = "WOLVERHAMPTON NORTH EAST" if district_code == 321 & election == "2005 British general election"
replace district_name = "WOLVERHAMPTON SOUTH EAST" if district_code == 322 & election == "2005 British general election"
replace district_name = "WOLVERHAMPTON SOUTH WEST" if district_code == 323 & election == "2005 British general election"
replace district_name = "AMBER VALLEY" if district_code == 324 & election == "2005 British general election"
replace district_name = "BOLSOVER" if district_code == 325 & election == "2005 British general election"
replace district_name = "CHESTERFIELD" if district_code == 326 & election == "2005 British general election"
replace district_name = "DERBY NORTH" if district_code == 327 & election == "2005 British general election"
replace district_name = "DERBY SOUTH" if district_code == 328 & election == "2005 British general election"
replace district_name = "EREWASH" if district_code == 329 & election == "2005 British general election"
replace district_name = "BRENTWOOD & ONGAR" if district_code == 33 & election == "2005 British general election"
replace district_name = "HIGH PEAK" if district_code == 330 & election == "2005 British general election"
replace district_name = "NORTH EAST DERBYSHIRE" if district_code == 331 & election == "2005 British general election"
replace district_name = "SOUTH DERBYSHIRE" if district_code == 332 & election == "2005 British general election"
replace district_name = "WEST DERBYSHIRE" if district_code == 333 & election == "2005 British general election"
replace district_name = "BLABY" if district_code == 334 & election == "2005 British general election"
replace district_name = "BOSWORTH" if district_code == 335 & election == "2005 British general election"
replace district_name = "CHARNWOOD" if district_code == 336 & election == "2005 British general election"
replace district_name = "HARBOROUGH" if district_code == 337 & election == "2005 British general election"
replace district_name = "LEICESTER EAST" if district_code == 338 & election == "2005 British general election"
replace district_name = "LEICESTER SOUTH" if district_code == 339 & election == "2005 British general election"
replace district_name = "CASTLE POINT" if district_code == 34 & election == "2005 British general election"
replace district_name = "LEICESTER WEST" if district_code == 340 & election == "2005 British general election"
replace district_name = "LOUGHBOROUGH" if district_code == 341 & election == "2005 British general election"
replace district_name = "NORTH WEST LEICESTERSHIRE" if district_code == 342 & election == "2005 British general election"
replace district_name = "RUTLAND & MELTON" if district_code == 343 & election == "2005 British general election"
replace district_name = "BOSTON & SKEGNESS" if district_code == 344 & election == "2005 British general election"
replace district_name = "GAINSBOROUGH" if district_code == 345 & election == "2005 British general election"
replace district_name = "GRANTHAM & STAMFORD" if district_code == 346 & election == "2005 British general election"
replace district_name = "LINCOLN" if district_code == 347 & election == "2005 British general election"
replace district_name = "LOUTH & HORNCASTLE" if district_code == 348 & election == "2005 British general election"
replace district_name = "SLEAFORD & NORTH HYKEHAM" if district_code == 349 & election == "2005 British general election"
replace district_name = "COLCHESTER" if district_code == 35 & election == "2005 British general election"
replace district_name = "SOUTH HOLLAND & THE DEEPINGS" if district_code == 350 & election == "2005 British general election"
replace district_name = "CORBY" if district_code == 351 & election == "2005 British general election"
replace district_name = "DAVENTRY" if district_code == 352 & election == "2005 British general election"
replace district_name = "KETTERING" if district_code == 353 & election == "2005 British general election"
replace district_name = "NORTHAMPTON NORTH" if district_code == 354 & election == "2005 British general election"
replace district_name = "NORTHAMPTON SOUTH" if district_code == 355 & election == "2005 British general election"
replace district_name = "WELLINGBOROUGH" if district_code == 356 & election == "2005 British general election"
replace district_name = "ASHFIELD" if district_code == 357 & election == "2005 British general election"
replace district_name = "BASSETLAW" if district_code == 358 & election == "2005 British general election"
replace district_name = "BROXTOWE" if district_code == 359 & election == "2005 British general election"
replace district_name = "EPPING FOREST" if district_code == 36 & election == "2005 British general election"
replace district_name = "GEDLING" if district_code == 360 & election == "2005 British general election"
replace district_name = "MANSFIELD" if district_code == 361 & election == "2005 British general election"
replace district_name = "NEWARK" if district_code == 362 & election == "2005 British general election"
replace district_name = "NOTTINGHAM EAST" if district_code == 363 & election == "2005 British general election"
replace district_name = "NOTTINGHAM NORTH" if district_code == 364 & election == "2005 British general election"
replace district_name = "NOTTINGHAM SOUTH" if district_code == 365 & election == "2005 British general election"
replace district_name = "RUSHCLIFFE" if district_code == 366 & election == "2005 British general election"
replace district_name = "SHERWOOD" if district_code == 367 & election == "2005 British general election"
replace district_name = "BEVERLEY & HOLDERNESS" if district_code == 368 & election == "2005 British general election"
replace district_name = "BRIGG & GOOLE" if district_code == 369 & election == "2005 British general election"
replace district_name = "HARLOW" if district_code == 37 & election == "2005 British general election"
replace district_name = "CLEETHORPES" if district_code == 370 & election == "2005 British general election"
replace district_name = "EAST YORKSHIRE" if district_code == 371 & election == "2005 British general election"
replace district_name = "GREAT GRIMSBY" if district_code == 372 & election == "2005 British general election"
replace district_name = "HALTEMPRICE & HOWDEN" if district_code == 373 & election == "2005 British general election"
replace district_name = "KINGSTON UPON HULL EAST" if district_code == 374 & election == "2005 British general election"
replace district_name = "KINGSTON UPON HULL NORTH" if district_code == 375 & election == "2005 British general election"
replace district_name = "KINGSTON UPON HULL WEST & HESSLE" if district_code == 376 & election == "2005 British general election"
replace district_name = "SCUNTHORPE" if district_code == 377 & election == "2005 British general election"
replace district_name = "HARROGATE & KNARESBOROUGH" if district_code == 378 & election == "2005 British general election"
replace district_name = "RICHMOND (YORKS)" if district_code == 379 & election == "2005 British general election"
replace district_name = "HARWICH" if district_code == 38 & election == "2005 British general election"
replace district_name = "RYEDALE" if district_code == 380 & election == "2005 British general election"
replace district_name = "SCARBOROUGH & WHITBY" if district_code == 381 & election == "2005 British general election"
replace district_name = "SELBY" if district_code == 382 & election == "2005 British general election"
replace district_name = "SKIPTON & RIPON" if district_code == 383 & election == "2005 British general election"
replace district_name = "VALE OF YORK" if district_code == 384 & election == "2005 British general election"
replace district_name = "YORK, CITY OF" if district_code == 385 & election == "2005 British general election"
replace district_name = "BARNSLEY CENTRAL" if district_code == 386 & election == "2005 British general election"
replace district_name = "BARNSLEY EAST & MEXBOROUGH" if district_code == 387 & election == "2005 British general election"
replace district_name = "BARNSLEY WEST & PENISTONE" if district_code == 388 & election == "2005 British general election"
replace district_name = "DON VALLEY" if district_code == 389 & election == "2005 British general election"
replace district_name = "MALDON & EAST CHELMSFORD" if district_code == 39 & election == "2005 British general election"
replace district_name = "DONCASTER CENTRAL" if district_code == 390 & election == "2005 British general election"
replace district_name = "DONCASTER NORTH" if district_code == 391 & election == "2005 British general election"
replace district_name = "ROTHER VALLEY" if district_code == 392 & election == "2005 British general election"
replace district_name = "ROTHERHAM" if district_code == 393 & election == "2005 British general election"
replace district_name = "SHEFFIELD, ATTERCLIFFE" if district_code == 394 & election == "2005 British general election"
replace district_name = "SHEFFIELD, BRIGHTSIDE" if district_code == 395 & election == "2005 British general election"
replace district_name = "SHEFFIELD CENTRAL" if district_code == 396 & election == "2005 British general election"
replace district_name = "SHEFFIELD, HALLAM" if district_code == 397 & election == "2005 British general election"
replace district_name = "SHEFFIELD, HEELEY" if district_code == 398 & election == "2005 British general election"
replace district_name = "SHEFFIELD, HILLSBOROUGH" if district_code == 399 & election == "2005 British general election"
replace district_name = "MID BEDFORDSHIRE" if district_code == 4 & election == "2005 British general election"
replace district_name = "NORTH ESSEX" if district_code == 40 & election == "2005 British general election"
replace district_name = "WENTWORTH" if district_code == 400 & election == "2005 British general election"
replace district_name = "BATLEY & SPEN" if district_code == 401 & election == "2005 British general election"
replace district_name = "BRADFORD NORTH" if district_code == 402 & election == "2005 British general election"
replace district_name = "BRADFORD SOUTH" if district_code == 403 & election == "2005 British general election"
replace district_name = "BRADFORD WEST" if district_code == 404 & election == "2005 British general election"
replace district_name = "CALDER VALLEY" if district_code == 405 & election == "2005 British general election"
replace district_name = "COLNE VALLEY" if district_code == 406 & election == "2005 British general election"
replace district_name = "DEWSBURY" if district_code == 407 & election == "2005 British general election"
replace district_name = "ELMET" if district_code == 408 & election == "2005 British general election"
replace district_name = "HALIFAX" if district_code == 409 & election == "2005 British general election"
replace district_name = "RAYLEIGH" if district_code == 41 & election == "2005 British general election"
replace district_name = "HEMSWORTH" if district_code == 410 & election == "2005 British general election"
replace district_name = "HUDDERSFIELD" if district_code == 411 & election == "2005 British general election"
replace district_name = "KEIGHLEY" if district_code == 412 & election == "2005 British general election"
replace district_name = "LEEDS CENTRAL" if district_code == 413 & election == "2005 British general election"
replace district_name = "LEEDS EAST" if district_code == 414 & election == "2005 British general election"
replace district_name = "LEEDS NORTH EAST" if district_code == 415 & election == "2005 British general election"
replace district_name = "LEEDS NORTH WEST" if district_code == 416 & election == "2005 British general election"
replace district_name = "LEEDS WEST" if district_code == 417 & election == "2005 British general election"
replace district_name = "MORLEY & ROTHWELL" if district_code == 418 & election == "2005 British general election"
replace district_name = "NORMANTON" if district_code == 419 & election == "2005 British general election"
replace district_name = "ROCHFORD & SOUTHEND EAST" if district_code == 42 & election == "2005 British general election"
replace district_name = "PONTEFRACT & CASTLEFORD" if district_code == 420 & election == "2005 British general election"
replace district_name = "PUDSEY" if district_code == 421 & election == "2005 British general election"
replace district_name = "SHIPLEY" if district_code == 422 & election == "2005 British general election"
replace district_name = "WAKEFIELD" if district_code == 423 & election == "2005 British general election"
replace district_name = "CHESTER, CITY OF" if district_code == 424 & election == "2005 British general election"
replace district_name = "CONGLETON" if district_code == 425 & election == "2005 British general election"
replace district_name = "CREWE & NANTWICH" if district_code == 426 & election == "2005 British general election"
replace district_name = "EDDISBURY" if district_code == 427 & election == "2005 British general election"
replace district_name = "ELLESMERE PORT & NESTON" if district_code == 428 & election == "2005 British general election"
replace district_name = "HALTON" if district_code == 429 & election == "2005 British general election"
replace district_name = "SAFFRON WALDEN" if district_code == 43 & election == "2005 British general election"
replace district_name = "MACCLESFIELD" if district_code == 430 & election == "2005 British general election"
replace district_name = "TATTON" if district_code == 431 & election == "2005 British general election"
replace district_name = "WARRINGTON NORTH" if district_code == 432 & election == "2005 British general election"
replace district_name = "WARRINGTON SOUTH" if district_code == 433 & election == "2005 British general election"
replace district_name = "WEAVER VALE" if district_code == 434 & election == "2005 British general election"
replace district_name = "ALTRINCHAM & SALE WEST" if district_code == 435 & election == "2005 British general election"
replace district_name = "ASHTON-UNDER-LYNE" if district_code == 436 & election == "2005 British general election"
replace district_name = "BOLTON NORTH EAST" if district_code == 437 & election == "2005 British general election"
replace district_name = "BOLTON SOUTH EAST" if district_code == 438 & election == "2005 British general election"
replace district_name = "BOLTON WEST" if district_code == 439 & election == "2005 British general election"
replace district_name = "SOUTHEND WEST" if district_code == 44 & election == "2005 British general election"
replace district_name = "BURY NORTH" if district_code == 440 & election == "2005 British general election"
replace district_name = "BURY SOUTH" if district_code == 441 & election == "2005 British general election"
replace district_name = "CHEADLE" if district_code == 442 & election == "2005 British general election"
replace district_name = "DENTON & REDDISH" if district_code == 443 & election == "2005 British general election"
replace district_name = "ECCLES" if district_code == 444 & election == "2005 British general election"
replace district_name = "HAZEL GROVE" if district_code == 445 & election == "2005 British general election"
replace district_name = "HEYWOOD & MIDDLETON" if district_code == 446 & election == "2005 British general election"
replace district_name = "LEIGH" if district_code == 447 & election == "2005 British general election"
replace district_name = "MAKERFIELD" if district_code == 448 & election == "2005 British general election"
replace district_name = "MANCHESTER, BLACKLEY" if district_code == 449 & election == "2005 British general election"
replace district_name = "THURROCK" if district_code == 45 & election == "2005 British general election"
replace district_name = "MANCHESTER CENTRAL" if district_code == 450 & election == "2005 British general election"
replace district_name = "MANCHESTER, GORTON" if district_code == 451 & election == "2005 British general election"
replace district_name = "MANCHESTER, WITHINGTON" if district_code == 452 & election == "2005 British general election"
replace district_name = "OLDHAM EAST & SADDLEWORTH" if district_code == 453 & election == "2005 British general election"
replace district_name = "OLDHAM WEST & ROYTON" if district_code == 454 & election == "2005 British general election"
replace district_name = "ROCHDALE" if district_code == 455 & election == "2005 British general election"
replace district_name = "SALFORD" if district_code == 456 & election == "2005 British general election"
replace district_name = "STALYBRIDGE & HYDE" if district_code == 457 & election == "2005 British general election"
replace district_name = "STOCKPORT" if district_code == 458 & election == "2005 British general election"
replace district_name = "STRETFORD & URMSTON" if district_code == 459 & election == "2005 British general election"
replace district_name = "WEST CHELMSFORD" if district_code == 46 & election == "2005 British general election"
replace district_name = "WIGAN" if district_code == 460 & election == "2005 British general election"
replace district_name = "WORSLEY" if district_code == 461 & election == "2005 British general election"
replace district_name = "WYTHENSHAWE & SALE EAST" if district_code == 462 & election == "2005 British general election"
replace district_name = "BLACKBURN" if district_code == 463 & election == "2005 British general election"
replace district_name = "BLACKPOOL NORTH & FLEETWOOD" if district_code == 464 & election == "2005 British general election"
replace district_name = "BLACKPOOL SOUTH" if district_code == 465 & election == "2005 British general election"
replace district_name = "BURNLEY" if district_code == 466 & election == "2005 British general election"
replace district_name = "CHORLEY" if district_code == 467 & election == "2005 British general election"
replace district_name = "FYLDE" if district_code == 468 & election == "2005 British general election"
replace district_name = "HYNDBURN" if district_code == 469 & election == "2005 British general election"
replace district_name = "ALDERSHOT" if district_code == 47 & election == "2005 British general election"
replace district_name = "LANCASTER & WYRE" if district_code == 470 & election == "2005 British general election"
replace district_name = "MORECAMBE & LUNESDALE" if district_code == 471 & election == "2005 British general election"
replace district_name = "PENDLE" if district_code == 472 & election == "2005 British general election"
replace district_name = "PRESTON" if district_code == 473 & election == "2005 British general election"
replace district_name = "RIBBLE VALLEY" if district_code == 474 & election == "2005 British general election"
replace district_name = "ROSSENDALE & DARWEN" if district_code == 475 & election == "2005 British general election"
replace district_name = "SOUTH RIBBLE" if district_code == 476 & election == "2005 British general election"
replace district_name = "WEST LANCASHIRE" if district_code == 477 & election == "2005 British general election"
replace district_name = "BIRKENHEAD" if district_code == 478 & election == "2005 British general election"
replace district_name = "BOOTLE" if district_code == 479 & election == "2005 British general election"
replace district_name = "BASINGSTOKE" if district_code == 48 & election == "2005 British general election"
replace district_name = "CROSBY" if district_code == 480 & election == "2005 British general election"
replace district_name = "KNOWSLEY NORTH & SEFTON EAST" if district_code == 481 & election == "2005 British general election"
replace district_name = "KNOWSLEY SOUTH" if district_code == 482 & election == "2005 British general election"
replace district_name = "LIVERPOOL, GARSTON" if district_code == 483 & election == "2005 British general election"
replace district_name = "LIVERPOOL, RIVERSIDE" if district_code == 484 & election == "2005 British general election"
replace district_name = "LIVERPOOL, WALTON" if district_code == 485 & election == "2005 British general election"
replace district_name = "LIVERPOOL, WAVERTREE" if district_code == 486 & election == "2005 British general election"
replace district_name = "LIVERPOOL, WEST DERBY" if district_code == 487 & election == "2005 British general election"
replace district_name = "SOUTHPORT" if district_code == 488 & election == "2005 British general election"
replace district_name = "ST HELENS NORTH" if district_code == 489 & election == "2005 British general election"
replace district_name = "EAST HAMPSHIRE" if district_code == 49 & election == "2005 British general election"
replace district_name = "ST HELENS SOUTH" if district_code == 490 & election == "2005 British general election"
replace district_name = "WALLASEY" if district_code == 491 & election == "2005 British general election"
replace district_name = "WIRRAL SOUTH" if district_code == 492 & election == "2005 British general election"
replace district_name = "WIRRAL WEST" if district_code == 493 & election == "2005 British general election"
replace district_name = "BARROW & FURNESS" if district_code == 494 & election == "2005 British general election"
replace district_name = "CARLISLE" if district_code == 495 & election == "2005 British general election"
replace district_name = "COPELAND" if district_code == 496 & election == "2005 British general election"
replace district_name = "PENRITH & THE BORDER" if district_code == 497 & election == "2005 British general election"
replace district_name = "WESTMORLAND & LONSDALE" if district_code == 498 & election == "2005 British general election"
replace district_name = "WORKINGTON" if district_code == 499 & election == "2005 British general election"
replace district_name = "BEDFORDSHIRE NORTH EAST" if district_code == 5 & election == "2005 British general election"
replace district_name = "EASTLEIGH" if district_code == 50 & election == "2005 British general election"
replace district_name = "HARTLEPOOL" if district_code == 500 & election == "2005 British general election"
replace district_name = "MIDDLESBROUGH" if district_code == 501 & election == "2005 British general election"
replace district_name = "MIDDLESBROUGH SOUTH & EAST CLEVELAND" if district_code == 502 & election == "2005 British general election"
replace district_name = "REDCAR" if district_code == 503 & election == "2005 British general election"
replace district_name = "STOCKTON NORTH" if district_code == 504 & election == "2005 British general election"
replace district_name = "STOCKTON SOUTH" if district_code == 505 & election == "2005 British general election"
replace district_name = "BISHOP AUCKLAND" if district_code == 506 & election == "2005 British general election"
replace district_name = "DARLINGTON" if district_code == 507 & election == "2005 British general election"
replace district_name = "DURHAM, CITY OF" if district_code == 508 & election == "2005 British general election"
replace district_name = "EASINGTON" if district_code == 509 & election == "2005 British general election"
replace district_name = "FAREHAM" if district_code == 51 & election == "2005 British general election"
replace district_name = "NORTH DURHAM" if district_code == 510 & election == "2005 British general election"
replace district_name = "NORTH WEST DURHAM" if district_code == 511 & election == "2005 British general election"
replace district_name = "SEDGEFIELD" if district_code == 512 & election == "2005 British general election"
replace district_name = "BERWICK-UPON-TWEED" if district_code == 513 & election == "2005 British general election"
replace district_name = "BLYTH VALLEY" if district_code == 514 & election == "2005 British general election"
replace district_name = "HEXHAM" if district_code == 515 & election == "2005 British general election"
replace district_name = "WANSBECK" if district_code == 516 & election == "2005 British general election"
replace district_name = "BLAYDON" if district_code == 517 & election == "2005 British general election"
replace district_name = "GATESHEAD EAST & WASHINGTON WEST" if district_code == 518 & election == "2005 British general election"
replace district_name = "HOUGHTON & WASHINGTON EAST" if district_code == 519 & election == "2005 British general election"
replace district_name = "GOSPORT" if district_code == 52 & election == "2005 British general election"
replace district_name = "JARROW" if district_code == 520 & election == "2005 British general election"
replace district_name = "NEWCASTLE UPON TYNE CENTRAL" if district_code == 521 & election == "2005 British general election"
replace district_name = "NEWCASTLE UPON TYNE NORTH" if district_code == 522 & election == "2005 British general election"
replace district_name = "NEWCASTLE UPON TYNE EAST & WALLSEND" if district_code == 523 & election == "2005 British general election"
replace district_name = "NORTH TYNESIDE" if district_code == 524 & election == "2005 British general election"
replace district_name = "SOUTH SHIELDS" if district_code == 525 & election == "2005 British general election"
replace district_name = "SUNDERLAND NORTH" if district_code == 526 & election == "2005 British general election"
replace district_name = "SUNDERLAND SOUTH" if district_code == 527 & election == "2005 British general election"
replace district_name = "TYNE BRIDGE" if district_code == 528 & election == "2005 British general election"
replace district_name = "TYNEMOUTH" if district_code == 529 & election == "2005 British general election"
replace district_name = "HAVANT" if district_code == 53 & election == "2005 British general election"
replace district_name = "ALYN & DEESIDE" if district_code == 530 & election == "2005 British general election"
replace district_name = "CLWYD SOUTH" if district_code == 531 & election == "2005 British general election"
replace district_name = "CLWYD WEST" if district_code == 532 & election == "2005 British general election"
replace district_name = "DELYN" if district_code == 533 & election == "2005 British general election"
replace district_name = "VALE OF CLWYD" if district_code == 534 & election == "2005 British general election"
replace district_name = "WREXHAM" if district_code == 535 & election == "2005 British general election"
replace district_name = "CARMARTHEN EAST & DINEFWR" if district_code == 536 & election == "2005 British general election"
replace district_name = "CARMARTHEN WEST & SOUTH PEMBROKESHIRE" if district_code == 537 & election == "2005 British general election"
replace district_name = "CEREDIGION" if district_code == 538 & election == "2005 British general election"
replace district_name = "LLANELLI" if district_code == 539 & election == "2005 British general election"
replace district_name = "NEW FOREST EAST" if district_code == 54 & election == "2005 British general election"
replace district_name = "PRESELI PEMBROKESHIRE" if district_code == 540 & election == "2005 British general election"
replace district_name = "BLAENAU GWENT" if district_code == 541 & election == "2005 British general election"
replace district_name = "ISLWYN" if district_code == 542 & election == "2005 British general election"
replace district_name = "MONMOUTH" if district_code == 543 & election == "2005 British general election"
replace district_name = "NEWPORT EAST" if district_code == 544 & election == "2005 British general election"
replace district_name = "NEWPORT WEST" if district_code == 545 & election == "2005 British general election"
replace district_name = "TORFAEN" if district_code == 546 & election == "2005 British general election"
replace district_name = "CAERNARFON" if district_code == 547 & election == "2005 British general election"
replace district_name = "CONWY" if district_code == 548 & election == "2005 British general election"
replace district_name = "MEIRIONNYDD NANT CONWY" if district_code == 549 & election == "2005 British general election"
replace district_name = "NEW FOREST WEST" if district_code == 55 & election == "2005 British general election"
replace district_name = "YNYS-MON" if district_code == 550 & election == "2005 British general election"
replace district_name = "BRIDGEND" if district_code == 551 & election == "2005 British general election"
replace district_name = "CAERPHILLY" if district_code == 552 & election == "2005 British general election"
replace district_name = "CYNON VALLEY" if district_code == 553 & election == "2005 British general election"
replace district_name = "MERTHYR TYDFIL & RHYMNEY" if district_code == 554 & election == "2005 British general election"
replace district_name = "OGMORE" if district_code == 555 & election == "2005 British general election"
replace district_name = "PONTYPRIDD" if district_code == 556 & election == "2005 British general election"
replace district_name = "RHONDDA" if district_code == 557 & election == "2005 British general election"
replace district_name = "BRECON & RADNORSHIRE" if district_code == 558 & election == "2005 British general election"
replace district_name = "MONTGOMERYSHIRE" if district_code == 559 & election == "2005 British general election"
replace district_name = "NORTH EAST HAMPSHIRE" if district_code == 56 & election == "2005 British general election"
replace district_name = "CARDIFF CENTRAL" if district_code == 560 & election == "2005 British general election"
replace district_name = "CARDIFF NORTH" if district_code == 561 & election == "2005 British general election"
replace district_name = "CARDIFF SOUTH & PENARTH" if district_code == 562 & election == "2005 British general election"
replace district_name = "CARDIFF WEST" if district_code == 563 & election == "2005 British general election"
replace district_name = "VALE OF GLAMORGAN" if district_code == 564 & election == "2005 British general election"
replace district_name = "ABERAVON" if district_code == 565 & election == "2005 British general election"
replace district_name = "GOWER" if district_code == 566 & election == "2005 British general election"
replace district_name = "NEATH" if district_code == 567 & election == "2005 British general election"
replace district_name = "SWANSEA EAST" if district_code == 568 & election == "2005 British general election"
replace district_name = "SWANSEA WEST" if district_code == 569 & election == "2005 British general election"
replace district_name = "NORTH WEST HAMPSHIRE" if district_code == 57 & election == "2005 British general election"
replace district_name = "PORTSMOUTH NORTH" if district_code == 58 & election == "2005 British general election"
replace district_name = "PORTSMOUTH SOUTH" if district_code == 59 & election == "2005 British general election"
replace district_name = "SOUTH WEST BEDFORDSHIRE" if district_code == 6 & election == "2005 British general election"
replace district_name = "ROMSEY" if district_code == 60 & election == "2005 British general election"
replace district_name = "SOUTHAMPTON, ITCHEN" if district_code == 61 & election == "2005 British general election"
replace district_name = "SOUTHAMPTON, TEST" if district_code == 62 & election == "2005 British general election"
replace district_name = "WINCHESTER" if district_code == 63 & election == "2005 British general election"
replace district_name = "BROXBOURNE" if district_code == 64 & election == "2005 British general election"
replace district_name = "BELFAST EAST" if district_code == 642 & election == "2005 British general election"
replace district_name = "BELFAST NORTH" if district_code == 643 & election == "2005 British general election"
replace district_name = "BELFAST SOUTH" if district_code == 644 & election == "2005 British general election"
replace district_name = "BELFAST WEST" if district_code == 645 & election == "2005 British general election"
replace district_name = "EAST ANTRIM" if district_code == 646 & election == "2005 British general election"
replace district_name = "EAST LONDONDERRY" if district_code == 647 & election == "2005 British general election"
replace district_name = "FERMANAGH & SOUTH TYRONE" if district_code == 648 & election == "2005 British general election"
replace district_name = "FOYLE" if district_code == 649 & election == "2005 British general election"
replace district_name = "HEMEL HEMPSTEAD" if district_code == 65 & election == "2005 British general election"
replace district_name = "LAGAN VALLEY" if district_code == 650 & election == "2005 British general election"
replace district_name = "MID ULSTER" if district_code == 651 & election == "2005 British general election"
replace district_name = "NEWRY & ARMAGH" if district_code == 652 & election == "2005 British general election"
replace district_name = "NORTH ANTRIM" if district_code == 653 & election == "2005 British general election"
replace district_name = "NORTH DOWN" if district_code == 654 & election == "2005 British general election"
replace district_name = "SOUTH ANTRIM" if district_code == 655 & election == "2005 British general election"
replace district_name = "SOUTH DOWN" if district_code == 656 & election == "2005 British general election"
replace district_name = "STRANGFORD" if district_code == 657 & election == "2005 British general election"
replace district_name = "UPPER BANN" if district_code == 658 & election == "2005 British general election"
replace district_name = "WEST TYRONE" if district_code == 659 & election == "2005 British general election"
replace district_name = "HERTFORD & STORTFORD" if district_code == 66 & election == "2005 British general election"
replace district_name = "HERTSMERE" if district_code == 67 & election == "2005 British general election"
replace district_name = "HITCHIN & HARPENDEN" if district_code == 68 & election == "2005 British general election"
replace district_name = "HERTFORDSHIRE NORTH EAST" if district_code == 69 & election == "2005 British general election"
replace district_name = "BRACKNELL" if district_code == 7 & election == "2005 British general election"
replace district_name = "SOUTH WEST HERTFORDSHIRE" if district_code == 70 & election == "2005 British general election"
replace district_name = "ST ALBANS" if district_code == 71 & election == "2005 British general election"
replace district_name = "STEVENAGE" if district_code == 72 & election == "2005 British general election"
replace district_name = "WATFORD" if district_code == 73 & election == "2005 British general election"
replace district_name = "WELWYN HATFIELD" if district_code == 74 & election == "2005 British general election"
replace district_name = "ISLE OF WIGHT" if district_code == 75 & election == "2005 British general election"
replace district_name = "ASHFORD" if district_code == 76 & election == "2005 British general election"
replace district_name = "CANTERBURY" if district_code == 77 & election == "2005 British general election"
replace district_name = "CHATHAM & AYLESFORD" if district_code == 78 & election == "2005 British general election"
replace district_name = "DARTFORD" if district_code == 79 & election == "2005 British general election"
replace district_name = "MAIDENHEAD" if district_code == 8 & election == "2005 British general election"
replace district_name = "DOVER" if district_code == 80 & election == "2005 British general election"
replace district_name = "FAVERSHAM & MID KENT" if district_code == 81 & election == "2005 British general election"
replace district_name = "FOLKESTONE & HYTHE" if district_code == 82 & election == "2005 British general election"
replace district_name = "GILLINGHAM" if district_code == 83 & election == "2005 British general election"
replace district_name = "GRAVESHAM" if district_code == 84 & election == "2005 British general election"
replace district_name = "MAIDSTONE & THE WEALD" if district_code == 85 & election == "2005 British general election"
replace district_name = "MEDWAY" if district_code == 86 & election == "2005 British general election"
replace district_name = "NORTH THANET" if district_code == 87 & election == "2005 British general election"
replace district_name = "SEVENOAKS" if district_code == 88 & election == "2005 British general election"
replace district_name = "SITTINGBOURNE & SHEPPEY" if district_code == 89 & election == "2005 British general election"
replace district_name = "NEWBURY" if district_code == 9 & election == "2005 British general election"
replace district_name = "SOUTH THANET" if district_code == 90 & election == "2005 British general election"
replace district_name = "TONBRIDGE & MALLING" if district_code == 91 & election == "2005 British general election"
replace district_name = "TUNBRIDGE WELLS" if district_code == 92 & election == "2005 British general election"
replace district_name = "BANBURY" if district_code == 93 & election == "2005 British general election"
replace district_name = "HENLEY" if district_code == 94 & election == "2005 British general election"
replace district_name = "OXFORD EAST" if district_code == 95 & election == "2005 British general election"
replace district_name = "OXFORD WEST & ABINGDON" if district_code == 96 & election == "2005 British general election"
replace district_name = "WANTAGE" if district_code == 97 & election == "2005 British general election"
replace district_name = "WITNEY" if district_code == 98 & election == "2005 British general election"
replace district_name = "EAST SURREY" if district_code == 99 & election == "2005 British general election"
replace district_name = "ABERDEEN NORTH" if district_code == 20001 & election == "2005 British general election"
replace district_name = "ABERDEEN SOUTH" if district_code == 20002 & election == "2005 British general election"
replace district_name = "AIRDRIE & SHOTTS" if district_code == 20003 & election == "2005 British general election"
replace district_name = "ANGUS" if district_code == 20004 & election == "2005 British general election"
replace district_name = "ARGYLL & BUTE" if district_code == 20005 & election == "2005 British general election"
replace district_name = "AYR, CARRICK & CUMNOCK" if district_code == 20006 & election == "2005 British general election"
replace district_name = "BANFF & BUCHAN" if district_code == 20007 & election == "2005 British general election"
replace district_name = "BERWICKSHIRE, ROXBURGH & SELKIRK" if district_code == 20008 & election == "2005 British general election"
replace district_name = "CAITHNESS, SUTHERLAND & EASTER ROSS" if district_code == 20009 & election == "2005 British general election"
replace district_name = "AYRSHIRE CENTRAL" if district_code == 20010 & election == "2005 British general election"
replace district_name = "COATBRIDGE, CHRYSTON & BELLSHILL" if district_code == 20011 & election == "2005 British general election"
replace district_name = "CUMBERNAULD, KILSYTH & KIRKINTILLOCH EAST" if district_code == 20012 & election == "2005 British general election"
replace district_name = "DUMFRIES & GALLOWAY" if district_code == 20013 & election == "2005 British general election"
replace district_name = "DUMFRIESSHIRE, CLYDESDALE & TWEEDDALE" if district_code == 20014 & election == "2005 British general election"
replace district_name = "DUNDEE EAST" if district_code == 20015 & election == "2005 British general election"
replace district_name = "DUNDEE WEST" if district_code == 20016 & election == "2005 British general election"
replace district_name = "DUNFERMLINE & WEST FIFE" if district_code == 20017 & election == "2005 British general election"
replace district_name = "DUNBARTONSHIRE EAST" if district_code == 20018 & election == "2005 British general election"
replace district_name = "EAST KILBRIDE, STRATHAVEN & LESMAHAGOW" if district_code == 20019 & election == "2005 British general election"
replace district_name = "EAST LOTHIAN" if district_code == 20020 & election == "2005 British general election"
replace district_name = "EAST RENFREWSHIRE" if district_code == 20021 & election == "2005 British general election"
replace district_name = "EDINBURGH EAST" if district_code == 20022 & election == "2005 British general election"
replace district_name = "EDINBURGH NORTH & LEITH" if district_code == 20023 & election == "2005 British general election"
replace district_name = "EDINBURGH SOUTH" if district_code == 20024 & election == "2005 British general election"
replace district_name = "EDINBURGH SOUTH WEST" if district_code == 20025 & election == "2005 British general election"
replace district_name = "EDINBURGH WEST" if district_code == 20026 & election == "2005 British general election"
replace district_name = "NA H-EILEANAN AN IAR" if district_code == 20027 & election == "2005 British general election"
replace district_name = "FALKIRK" if district_code == 20028 & election == "2005 British general election"
replace district_name = "GLASGOW CENTRAL" if district_code == 20029 & election == "2005 British general election"
replace district_name = "GLASGOW EAST" if district_code == 20030 & election == "2005 British general election"
replace district_name = "GLASGOW NORTH" if district_code == 20031 & election == "2005 British general election"
replace district_name = "GLASGOW NORTH EAST" if district_code == 20032 & election == "2005 British general election"
replace district_name = "GLASGOW NORTH WEST" if district_code == 20033 & election == "2005 British general election"
replace district_name = "GLASGOW SOUTH" if district_code == 20034 & election == "2005 British general election"
replace district_name = "GLASGOW SOUTH WEST" if district_code == 20035 & election == "2005 British general election"
replace district_name = "GLENROTHES" if district_code == 20036 & election == "2005 British general election"
replace district_name = "GORDON" if district_code == 20037 & election == "2005 British general election"
replace district_name = "INVERCLYDE" if district_code == 20038 & election == "2005 British general election"
replace district_name = "INVERNESS, NAIRN, BADENOCH & STRATHSPEY" if district_code == 20039 & election == "2005 British general election"
replace district_name = "KILMARNOCK & LOUDOUN" if district_code == 20040 & election == "2005 British general election"
replace district_name = "KIRKCALDY & COWDENBEATH" if district_code == 20041 & election == "2005 British general election"
replace district_name = "LANARCK & HAMILTON EAST" if district_code == 20042 & election == "2005 British general election"
replace district_name = "LINLITHGOW & EAST FALKIRK" if district_code == 20043 & election == "2005 British general election"
replace district_name = "LIVINGSTONE" if district_code == 20044 & election == "2005 British general election"
replace district_name = "MIDLOTHIAN" if district_code == 20045 & election == "2005 British general election"
replace district_name = "MORAY" if district_code == 20046 & election == "2005 British general election"
replace district_name = "MOTHERWELL & WISHAW" if district_code == 20047 & election == "2005 British general election"
replace district_name = "NORTH AYRSHIRE & ARRAN" if district_code == 20048 & election == "2005 British general election"
replace district_name = "NORTH EAST FIFE" if district_code == 20049 & election == "2005 British general election"
replace district_name = "OCHIL & SOUTH PERTHSHIRE" if district_code == 20050 & election == "2005 British general election"
replace district_name = "ORKNEY & SHETLAND" if district_code == 20051 & election == "2005 British general election"
replace district_name = "PAISLEY & RENFREWSHIRE NORTH" if district_code == 20052 & election == "2005 British general election"
replace district_name = "PAISLEY & RENFREWSHIRE SOUTH" if district_code == 20053 & election == "2005 British general election"
replace district_name = "PERTH & NORTH PERTHSHIRE" if district_code == 20054 & election == "2005 British general election"
replace district_name = "ROSS, SKYE & LOCHABER" if district_code == 20055 & election == "2005 British general election"
replace district_name = "RUTHERGLEN & HAMILTON WEST" if district_code == 20056 & election == "2005 British general election"
replace district_name = "STIRLING" if district_code == 20057 & election == "2005 British general election"
replace district_name = "ABERDEENSHIRE WEST & KINCARDINE" if district_code == 20058 & election == "2005 British general election"
replace district_name = "DUNBARTONSHIRE WEST" if district_code == 20059 & election == "2005 British general election"
replace district_name = "ALDERSHOT" if district_code == 10530 & election == "2010 British general election"
replace district_name = "ALDRIDGE-BROWNHILLS" if district_code == 10531 & election == "2010 British general election"
replace district_name = "ALTRINCHAM AND SALE WEST" if district_code == 10532 & election == "2010 British general election"
replace district_name = "AMBER VALLEY" if district_code == 10533 & election == "2010 British general election"
replace district_name = "ARUNDEL AND SOUTH DOWNS" if district_code == 10534 & election == "2010 British general election"
replace district_name = "ASHFIELD" if district_code == 10535 & election == "2010 British general election"
replace district_name = "ASHFORD" if district_code == 10536 & election == "2010 British general election"
replace district_name = "ASHTON-UNDER-LYNE" if district_code == 10537 & election == "2010 British general election"
replace district_name = "AYLESBURY" if district_code == 10538 & election == "2010 British general election"
replace district_name = "BANBURY" if district_code == 10539 & election == "2010 British general election"
replace district_name = "BARKING" if district_code == 10540 & election == "2010 British general election"
replace district_name = "BARNSLEY CENTRAL" if district_code == 10541 & election == "2010 British general election"
replace district_name = "BARNSLEY EAST" if district_code == 10542 & election == "2010 British general election"
replace district_name = "BARROW AND FURNESS" if district_code == 10543 & election == "2010 British general election"
replace district_name = "BASILDON AND BILLERICAY" if district_code == 10544 & election == "2010 British general election"
replace district_name = "BASINGSTOKE" if district_code == 10545 & election == "2010 British general election"
replace district_name = "BASSETLAW" if district_code == 10546 & election == "2010 British general election"
replace district_name = "BATH" if district_code == 10547 & election == "2010 British general election"
replace district_name = "BATLEY AND SPEN" if district_code == 10548 & election == "2010 British general election"
replace district_name = "BATTERSEA" if district_code == 10549 & election == "2010 British general election"
replace district_name = "BEACONSFIELD" if district_code == 10550 & election == "2010 British general election"
replace district_name = "BECKENHAM" if district_code == 10551 & election == "2010 British general election"
replace district_name = "BEDFORD" if district_code == 10552 & election == "2010 British general election"
replace district_name = "BERMONDSEY AND OLD SOUTHWARK" if district_code == 10553 & election == "2010 British general election"
replace district_name = "BERWICK-UPON-TWEED" if district_code == 10554 & election == "2010 British general election"
replace district_name = "BETHNAL GREEN AND BOW" if district_code == 10555 & election == "2010 British general election"
replace district_name = "BEVERLEY AND HOLDERNESS" if district_code == 10556 & election == "2010 British general election"
replace district_name = "BEXHILL AND BATTLE" if district_code == 10557 & election == "2010 British general election"
replace district_name = "BEXLEYHEATH AND CRAYFORD" if district_code == 10558 & election == "2010 British general election"
replace district_name = "BIRKENHEAD" if district_code == 10559 & election == "2010 British general election"
replace district_name = "BIRMINGHAM, EDGBASTON" if district_code == 10560 & election == "2010 British general election"
replace district_name = "BIRMINGHAM, ERDINGTON" if district_code == 10561 & election == "2010 British general election"
replace district_name = "BIRMINGHAM, HALL GREEN" if district_code == 10562 & election == "2010 British general election"
replace district_name = "BIRMINGHAM, HODGE HILL" if district_code == 10563 & election == "2010 British general election"
replace district_name = "BIRMINGHAM, LADYWOOD" if district_code == 10564 & election == "2010 British general election"
replace district_name = "BIRMINGHAM, NORTHFIELD" if district_code == 10565 & election == "2010 British general election"
replace district_name = "BIRMINGHAM, PERRY BARR" if district_code == 10566 & election == "2010 British general election"
replace district_name = "BIRMINGHAM, SELLY OAK" if district_code == 10567 & election == "2010 British general election"
replace district_name = "BIRMINGHAM, YARDLEY" if district_code == 10568 & election == "2010 British general election"
replace district_name = "BISHOP AUCKLAND" if district_code == 10569 & election == "2010 British general election"
replace district_name = "BLACKBURN" if district_code == 10570 & election == "2010 British general election"
replace district_name = "BLACKLEY AND BROUGHTON" if district_code == 10571 & election == "2010 British general election"
replace district_name = "BLACKPOOL NORTH AND CLEVELEYS" if district_code == 10572 & election == "2010 British general election"
replace district_name = "BLACKPOOL SOUTH" if district_code == 10573 & election == "2010 British general election"
replace district_name = "BLAYDON" if district_code == 10574 & election == "2010 British general election"
replace district_name = "BLYTH VALLEY" if district_code == 10575 & election == "2010 British general election"
replace district_name = "BOGNOR REGIS AND LITTLEHAMPTON" if district_code == 10576 & election == "2010 British general election"
replace district_name = "BOLSOVER" if district_code == 10577 & election == "2010 British general election"
replace district_name = "BOLTON NORTH EAST" if district_code == 10578 & election == "2010 British general election"
replace district_name = "BOLTON SOUTH EAST" if district_code == 10579 & election == "2010 British general election"
replace district_name = "BOLTON WEST" if district_code == 10580 & election == "2010 British general election"
replace district_name = "BOOTLE" if district_code == 10581 & election == "2010 British general election"
replace district_name = "BOSTON AND SKEGNESS" if district_code == 10582 & election == "2010 British general election"
replace district_name = "BOSWORTH" if district_code == 10583 & election == "2010 British general election"
replace district_name = "BOURNEMOUTH EAST" if district_code == 10584 & election == "2010 British general election"
replace district_name = "BOURNEMOUTH WEST" if district_code == 10585 & election == "2010 British general election"
replace district_name = "BRACKNELL" if district_code == 10586 & election == "2010 British general election"
replace district_name = "BRADFORD EAST" if district_code == 10587 & election == "2010 British general election"
replace district_name = "BRADFORD SOUTH" if district_code == 10588 & election == "2010 British general election"
replace district_name = "BRADFORD WEST" if district_code == 10589 & election == "2010 British general election"
replace district_name = "BRAINTREE" if district_code == 10590 & election == "2010 British general election"
replace district_name = "BRENT CENTRAL" if district_code == 10591 & election == "2010 British general election"
replace district_name = "BRENT NORTH" if district_code == 10592 & election == "2010 British general election"
replace district_name = "BRENTFORD AND ISLEWORTH" if district_code == 10593 & election == "2010 British general election"
replace district_name = "BRENTWOOD AND ONGAR" if district_code == 10594 & election == "2010 British general election"
replace district_name = "BRIDGWATER AND WEST SOMERSET" if district_code == 10595 & election == "2010 British general election"
replace district_name = "BRIGG AND GOOLE" if district_code == 10596 & election == "2010 British general election"
replace district_name = "BRIGHTON, KEMPTOWN" if district_code == 10597 & election == "2010 British general election"
replace district_name = "BRIGHTON, PAVILION" if district_code == 10598 & election == "2010 British general election"
replace district_name = "BRISTOL EAST" if district_code == 10599 & election == "2010 British general election"
replace district_name = "BRISTOL NORTH WEST" if district_code == 10600 & election == "2010 British general election"
replace district_name = "BRISTOL SOUTH" if district_code == 10601 & election == "2010 British general election"
replace district_name = "BRISTOL WEST" if district_code == 10602 & election == "2010 British general election"
replace district_name = "BROADLAND" if district_code == 10603 & election == "2010 British general election"
replace district_name = "BROMLEY AND CHISLEHURST" if district_code == 10604 & election == "2010 British general election"
replace district_name = "BROMSGROVE" if district_code == 10605 & election == "2010 British general election"
replace district_name = "BROXBOURNE" if district_code == 10606 & election == "2010 British general election"
replace district_name = "BROXTOWE" if district_code == 10607 & election == "2010 British general election"
replace district_name = "BUCKINGHAM" if district_code == 10608 & election == "2010 British general election"
replace district_name = "BURNLEY" if district_code == 10609 & election == "2010 British general election"
replace district_name = "BURTON" if district_code == 10610 & election == "2010 British general election"
replace district_name = "BURY NORTH" if district_code == 10611 & election == "2010 British general election"
replace district_name = "BURY SOUTH" if district_code == 10612 & election == "2010 British general election"
replace district_name = "BURY ST EDMUNDS" if district_code == 10613 & election == "2010 British general election"
replace district_name = "CALDER VALLEY" if district_code == 10614 & election == "2010 British general election"
replace district_name = "CAMBERWELL AND PECKHAM" if district_code == 10615 & election == "2010 British general election"
replace district_name = "CAMBORNE AND REDRUTH" if district_code == 10616 & election == "2010 British general election"
replace district_name = "CAMBRIDGE" if district_code == 10617 & election == "2010 British general election"
replace district_name = "CANNOCK CHASE" if district_code == 10618 & election == "2010 British general election"
replace district_name = "CANTERBURY" if district_code == 10619 & election == "2010 British general election"
replace district_name = "CARLISLE" if district_code == 10620 & election == "2010 British general election"
replace district_name = "CARSHALTON AND WALLINGTON" if district_code == 10621 & election == "2010 British general election"
replace district_name = "CASTLE POINT" if district_code == 10622 & election == "2010 British general election"
replace district_name = "CENTRAL DEVON" if district_code == 10623 & election == "2010 British general election"
replace district_name = "CENTRAL SUFFOLK AND NORTH IPSWICH" if district_code == 10624 & election == "2010 British general election"
replace district_name = "CHARNWOOD" if district_code == 10625 & election == "2010 British general election"
replace district_name = "CHATHAM AND AYLESFORD" if district_code == 10626 & election == "2010 British general election"
replace district_name = "CHEADLE" if district_code == 10627 & election == "2010 British general election"
replace district_name = "CHELMSFORD" if district_code == 10628 & election == "2010 British general election"
replace district_name = "CHELSEA AND FULHAM" if district_code == 10629 & election == "2010 British general election"
replace district_name = "CHELTENHAM" if district_code == 10630 & election == "2010 British general election"
replace district_name = "CHESHAM AND AMERSHAM" if district_code == 10631 & election == "2010 British general election"
replace district_name = "CHESTERFIELD" if district_code == 10632 & election == "2010 British general election"
replace district_name = "CHICHESTER" if district_code == 10633 & election == "2010 British general election"
replace district_name = "CHINGFORD AND WOODFORD GREEN" if district_code == 10634 & election == "2010 British general election"
replace district_name = "CHIPPENHAM" if district_code == 10635 & election == "2010 British general election"
replace district_name = "CHIPPING BARNET" if district_code == 10636 & election == "2010 British general election"
replace district_name = "CHORLEY" if district_code == 10637 & election == "2010 British general election"
replace district_name = "CHRISTCHURCH" if district_code == 10638 & election == "2010 British general election"
replace district_name = "CITIES OF LONDON AND WESTMINSTER" if district_code == 10639 & election == "2010 British general election"
replace district_name = "CITY OF CHESTER" if district_code == 10640 & election == "2010 British general election"
replace district_name = "CITY OF DURHAM" if district_code == 10641 & election == "2010 British general election"
replace district_name = "CLACTON" if district_code == 10642 & election == "2010 British general election"
replace district_name = "CLEETHORPES" if district_code == 10643 & election == "2010 British general election"
replace district_name = "COLCHESTER" if district_code == 10644 & election == "2010 British general election"
replace district_name = "COLNE VALLEY" if district_code == 10645 & election == "2010 British general election"
replace district_name = "CONGLETON" if district_code == 10646 & election == "2010 British general election"
replace district_name = "COPELAND" if district_code == 10647 & election == "2010 British general election"
replace district_name = "CORBY" if district_code == 10648 & election == "2010 British general election"
replace district_name = "COVENTRY NORTH EAST" if district_code == 10649 & election == "2010 British general election"
replace district_name = "COVENTRY NORTH WEST" if district_code == 10650 & election == "2010 British general election"
replace district_name = "COVENTRY SOUTH" if district_code == 10651 & election == "2010 British general election"
replace district_name = "CRAWLEY" if district_code == 10652 & election == "2010 British general election"
replace district_name = "CREWE AND NANTWICH" if district_code == 10653 & election == "2010 British general election"
replace district_name = "CROYDON CENTRAL" if district_code == 10654 & election == "2010 British general election"
replace district_name = "CROYDON NORTH" if district_code == 10655 & election == "2010 British general election"
replace district_name = "CROYDON SOUTH" if district_code == 10656 & election == "2010 British general election"
replace district_name = "DAGENHAM AND RAINHAM" if district_code == 10657 & election == "2010 British general election"
replace district_name = "DARLINGTON" if district_code == 10658 & election == "2010 British general election"
replace district_name = "DARTFORD" if district_code == 10659 & election == "2010 British general election"
replace district_name = "DAVENTRY" if district_code == 10660 & election == "2010 British general election"
replace district_name = "DENTON AND REDDISH" if district_code == 10661 & election == "2010 British general election"
replace district_name = "DERBY NORTH" if district_code == 10662 & election == "2010 British general election"
replace district_name = "DERBY SOUTH" if district_code == 10663 & election == "2010 British general election"
replace district_name = "DERBYSHIRE DALES" if district_code == 10664 & election == "2010 British general election"
replace district_name = "DEVIZES" if district_code == 10665 & election == "2010 British general election"
replace district_name = "DEWSBURY" if district_code == 10666 & election == "2010 British general election"
replace district_name = "DON VALLEY" if district_code == 10667 & election == "2010 British general election"
replace district_name = "DONCASTER CENTRAL" if district_code == 10668 & election == "2010 British general election"
replace district_name = "DONCASTER NORTH" if district_code == 10669 & election == "2010 British general election"
replace district_name = "DOVER" if district_code == 10670 & election == "2010 British general election"
replace district_name = "DUDLEY NORTH" if district_code == 10671 & election == "2010 British general election"
replace district_name = "DUDLEY SOUTH" if district_code == 10672 & election == "2010 British general election"
replace district_name = "DULWICH AND WEST NORWOOD" if district_code == 10673 & election == "2010 British general election"
replace district_name = "EALING CENTRAL AND ACTON" if district_code == 10674 & election == "2010 British general election"
replace district_name = "EALING NORTH" if district_code == 10675 & election == "2010 British general election"
replace district_name = "EALING, SOUTHALL" if district_code == 10676 & election == "2010 British general election"
replace district_name = "EASINGTON" if district_code == 10677 & election == "2010 British general election"
replace district_name = "EAST DEVON" if district_code == 10678 & election == "2010 British general election"
replace district_name = "EAST HAM" if district_code == 10679 & election == "2010 British general election"
replace district_name = "EAST HAMPSHIRE" if district_code == 10680 & election == "2010 British general election"
replace district_name = "EAST SURREY" if district_code == 10681 & election == "2010 British general election"
replace district_name = "EAST WORTHING AND SHOREHAM" if district_code == 10682 & election == "2010 British general election"
replace district_name = "EAST YORKSHIRE" if district_code == 10683 & election == "2010 British general election"
replace district_name = "EASTBOURNE" if district_code == 10684 & election == "2010 British general election"
replace district_name = "EASTLEIGH" if district_code == 10685 & election == "2010 British general election"
replace district_name = "EDDISBURY" if district_code == 10686 & election == "2010 British general election"
replace district_name = "EDMONTON" if district_code == 10687 & election == "2010 British general election"
replace district_name = "ELLESMERE PORT AND NESTON" if district_code == 10688 & election == "2010 British general election"
replace district_name = "ELMET AND ROTHWELL" if district_code == 10689 & election == "2010 British general election"
replace district_name = "ELTHAM" if district_code == 10690 & election == "2010 British general election"
replace district_name = "ENFIELD NORTH" if district_code == 10691 & election == "2010 British general election"
replace district_name = "ENFIELD, SOUTHGATE" if district_code == 10692 & election == "2010 British general election"
replace district_name = "EPPING FOREST" if district_code == 10693 & election == "2010 British general election"
replace district_name = "EPSOM AND EWELL" if district_code == 10694 & election == "2010 British general election"
replace district_name = "EREWASH" if district_code == 10695 & election == "2010 British general election"
replace district_name = "ERITH AND THAMESMEAD" if district_code == 10696 & election == "2010 British general election"
replace district_name = "ESHER AND WALTON" if district_code == 10697 & election == "2010 British general election"
replace district_name = "EXETER" if district_code == 10698 & election == "2010 British general election"
replace district_name = "FAREHAM" if district_code == 10699 & election == "2010 British general election"
replace district_name = "FAVERSHAM AND MID KENT" if district_code == 10700 & election == "2010 British general election"
replace district_name = "FELTHAM AND HESTON" if district_code == 10701 & election == "2010 British general election"
replace district_name = "FILTON AND BRADLEY STOKE" if district_code == 10702 & election == "2010 British general election"
replace district_name = "FINCHLEY AND GOLDERS GREEN" if district_code == 10703 & election == "2010 British general election"
replace district_name = "FOLKESTONE AND HYTHE" if district_code == 10704 & election == "2010 British general election"
replace district_name = "FOREST OF DEAN" if district_code == 10705 & election == "2010 British general election"
replace district_name = "FYLDE" if district_code == 10706 & election == "2010 British general election"
replace district_name = "GAINSBOROUGH" if district_code == 10707 & election == "2010 British general election"
replace district_name = "GARSTON AND HALEWOOD" if district_code == 10708 & election == "2010 British general election"
replace district_name = "GATESHEAD" if district_code == 10709 & election == "2010 British general election"
replace district_name = "GEDLING" if district_code == 10710 & election == "2010 British general election"
replace district_name = "GILLINGHAM AND RAINHAM" if district_code == 10711 & election == "2010 British general election"
replace district_name = "GLOUCESTER" if district_code == 10712 & election == "2010 British general election"
replace district_name = "GOSPORT" if district_code == 10713 & election == "2010 British general election"
replace district_name = "GRANTHAM AND STAMFORD" if district_code == 10714 & election == "2010 British general election"
replace district_name = "GRAVESHAM" if district_code == 10715 & election == "2010 British general election"
replace district_name = "GREAT GRIMSBY" if district_code == 10716 & election == "2010 British general election"
replace district_name = "GREAT YARMOUTH" if district_code == 10717 & election == "2010 British general election"
replace district_name = "GREENWICH AND WOOLWICH" if district_code == 10718 & election == "2010 British general election"
replace district_name = "GUILDFORD" if district_code == 10719 & election == "2010 British general election"
replace district_name = "HACKNEY NORTH AND STOKE NEWINGTON" if district_code == 10720 & election == "2010 British general election"
replace district_name = "HACKNEY SOUTH AND SHOREDITCH" if district_code == 10721 & election == "2010 British general election"
replace district_name = "HALESOWEN AND ROWLEY REGIS" if district_code == 10722 & election == "2010 British general election"
replace district_name = "HALIFAX" if district_code == 10723 & election == "2010 British general election"
replace district_name = "HALTEMPRICE AND HOWDEN" if district_code == 10724 & election == "2010 British general election"
replace district_name = "HALTON" if district_code == 10725 & election == "2010 British general election"
replace district_name = "HAMMERSMITH" if district_code == 10726 & election == "2010 British general election"
replace district_name = "HAMPSTEAD AND KILBURN" if district_code == 10727 & election == "2010 British general election"
replace district_name = "HARBOROUGH" if district_code == 10728 & election == "2010 British general election"
replace district_name = "HARLOW" if district_code == 10729 & election == "2010 British general election"
replace district_name = "HARROGATE AND KNARESBOROUGH" if district_code == 10730 & election == "2010 British general election"
replace district_name = "HARROW EAST" if district_code == 10731 & election == "2010 British general election"
replace district_name = "HARROW WEST" if district_code == 10732 & election == "2010 British general election"
replace district_name = "HARTLEPOOL" if district_code == 10733 & election == "2010 British general election"
replace district_name = "HARWICH AND NORTH ESSEX" if district_code == 10734 & election == "2010 British general election"
replace district_name = "HASTINGS AND RYE" if district_code == 10735 & election == "2010 British general election"
replace district_name = "HAVANT" if district_code == 10736 & election == "2010 British general election"
replace district_name = "HAYES AND HARLINGTON" if district_code == 10737 & election == "2010 British general election"
replace district_name = "HAZEL GROVE" if district_code == 10738 & election == "2010 British general election"
replace district_name = "HEMEL HEMPSTEAD" if district_code == 10739 & election == "2010 British general election"
replace district_name = "HEMSWORTH" if district_code == 10740 & election == "2010 British general election"
replace district_name = "HENDON" if district_code == 10741 & election == "2010 British general election"
replace district_name = "HENLEY" if district_code == 10742 & election == "2010 British general election"
replace district_name = "HEREFORD AND SOUTH HEREFORDSHIRE" if district_code == 10743 & election == "2010 British general election"
replace district_name = "HERTFORD AND STORTFORD" if district_code == 10744 & election == "2010 British general election"
replace district_name = "HERTSMERE" if district_code == 10745 & election == "2010 British general election"
replace district_name = "HEXHAM" if district_code == 10746 & election == "2010 British general election"
replace district_name = "HEYWOOD AND MIDDLETON" if district_code == 10747 & election == "2010 British general election"
replace district_name = "HIGH PEAK" if district_code == 10748 & election == "2010 British general election"
replace district_name = "HITCHIN AND HARPENDEN" if district_code == 10749 & election == "2010 British general election"
replace district_name = "HOLBORN AND ST PANCRAS" if district_code == 10750 & election == "2010 British general election"
replace district_name = "HORNCHURCH AND UPMINSTER" if district_code == 10751 & election == "2010 British general election"
replace district_name = "HORNSEY AND WOOD GREEN" if district_code == 10752 & election == "2010 British general election"
replace district_name = "HORSHAM" if district_code == 10753 & election == "2010 British general election"
replace district_name = "HOUGHTON AND SUNDERLAND SOUTH" if district_code == 10754 & election == "2010 British general election"
replace district_name = "HOVE" if district_code == 10755 & election == "2010 British general election"
replace district_name = "HUDDERSFIELD" if district_code == 10756 & election == "2010 British general election"
replace district_name = "HUNTINGDON" if district_code == 10757 & election == "2010 British general election"
replace district_name = "HYNDBURN" if district_code == 10758 & election == "2010 British general election"
replace district_name = "ILFORD NORTH" if district_code == 10759 & election == "2010 British general election"
replace district_name = "ILFORD SOUTH" if district_code == 10760 & election == "2010 British general election"
replace district_name = "IPSWICH" if district_code == 10761 & election == "2010 British general election"
replace district_name = "ISLE OF WIGHT" if district_code == 10762 & election == "2010 British general election"
replace district_name = "ISLINGTON NORTH" if district_code == 10763 & election == "2010 British general election"
replace district_name = "ISLINGTON SOUTH AND FINSBURY" if district_code == 10764 & election == "2010 British general election"
replace district_name = "JARROW" if district_code == 10765 & election == "2010 British general election"
replace district_name = "KEIGHLEY" if district_code == 10766 & election == "2010 British general election"
replace district_name = "KENILWORTH AND SOUTHAM" if district_code == 10767 & election == "2010 British general election"
replace district_name = "KENSINGTON" if district_code == 10768 & election == "2010 British general election"
replace district_name = "KETTERING" if district_code == 10769 & election == "2010 British general election"
replace district_name = "KINGSTON AND SURBITON" if district_code == 10770 & election == "2010 British general election"
replace district_name = "KINGSTON UPON HULL EAST" if district_code == 10771 & election == "2010 British general election"
replace district_name = "KINGSTON UPON HULL NORTH" if district_code == 10772 & election == "2010 British general election"
replace district_name = "KINGSTON UPON HULL WEST AND HESSLE" if district_code == 10773 & election == "2010 British general election"
replace district_name = "KINGSWOOD" if district_code == 10774 & election == "2010 British general election"
replace district_name = "KNOWSLEY" if district_code == 10775 & election == "2010 British general election"
replace district_name = "LANCASTER AND FLEETWOOD" if district_code == 10776 & election == "2010 British general election"
replace district_name = "LEEDS CENTRAL" if district_code == 10777 & election == "2010 British general election"
replace district_name = "LEEDS EAST" if district_code == 10778 & election == "2010 British general election"
replace district_name = "LEEDS NORTH EAST" if district_code == 10779 & election == "2010 British general election"
replace district_name = "LEEDS NORTH WEST" if district_code == 10780 & election == "2010 British general election"
replace district_name = "LEEDS WEST" if district_code == 10781 & election == "2010 British general election"
replace district_name = "LEICESTER EAST" if district_code == 10782 & election == "2010 British general election"
replace district_name = "LEICESTER SOUTH" if district_code == 10783 & election == "2010 British general election"
replace district_name = "LEICESTER WEST" if district_code == 10784 & election == "2010 British general election"
replace district_name = "LEIGH" if district_code == 10785 & election == "2010 British general election"
replace district_name = "LEWES" if district_code == 10786 & election == "2010 British general election"
replace district_name = "LEWISHAM EAST" if district_code == 10787 & election == "2010 British general election"
replace district_name = "LEWISHAM WEST AND PENGE" if district_code == 10788 & election == "2010 British general election"
replace district_name = "LEWISHAM, DEPTFORD" if district_code == 10789 & election == "2010 British general election"
replace district_name = "LEYTON AND WANSTEAD" if district_code == 10790 & election == "2010 British general election"
replace district_name = "LICHFIELD" if district_code == 10791 & election == "2010 British general election"
replace district_name = "LINCOLN" if district_code == 10792 & election == "2010 British general election"
replace district_name = "LIVERPOOL, RIVERSIDE" if district_code == 10793 & election == "2010 British general election"
replace district_name = "LIVERPOOL, WALTON" if district_code == 10794 & election == "2010 British general election"
replace district_name = "LIVERPOOL, WAVERTREE" if district_code == 10795 & election == "2010 British general election"
replace district_name = "LIVERPOOL, WEST DERBY" if district_code == 10796 & election == "2010 British general election"
replace district_name = "LOUGHBOROUGH" if district_code == 10797 & election == "2010 British general election"
replace district_name = "LOUTH AND HORNCASTLE" if district_code == 10798 & election == "2010 British general election"
replace district_name = "LUDLOW" if district_code == 10799 & election == "2010 British general election"
replace district_name = "LUTON NORTH" if district_code == 10800 & election == "2010 British general election"
replace district_name = "LUTON SOUTH" if district_code == 10801 & election == "2010 British general election"
replace district_name = "MACCLESFIELD" if district_code == 10802 & election == "2010 British general election"
replace district_name = "MAIDENHEAD" if district_code == 10803 & election == "2010 British general election"
replace district_name = "MAIDSTONE AND THE WEALD" if district_code == 10804 & election == "2010 British general election"
replace district_name = "MAKERFIELD" if district_code == 10805 & election == "2010 British general election"
replace district_name = "MALDON" if district_code == 10806 & election == "2010 British general election"
replace district_name = "MANCHESTER CENTRAL" if district_code == 10807 & election == "2010 British general election"
replace district_name = "MANCHESTER, GORTON" if district_code == 10808 & election == "2010 British general election"
replace district_name = "MANCHESTER, WITHINGTON" if district_code == 10809 & election == "2010 British general election"
replace district_name = "MANSFIELD" if district_code == 10810 & election == "2010 British general election"
replace district_name = "MEON VALLEY" if district_code == 10811 & election == "2010 British general election"
replace district_name = "MERIDEN" if district_code == 10812 & election == "2010 British general election"
replace district_name = "MID BEDFORDSHIRE" if district_code == 10813 & election == "2010 British general election"
replace district_name = "MID DERBYSHIRE" if district_code == 10814 & election == "2010 British general election"
replace district_name = "MID DORSET AND NORTH POOLE" if district_code == 10815 & election == "2010 British general election"
replace district_name = "MID NORFOLK" if district_code == 10816 & election == "2010 British general election"
replace district_name = "MID SUSSEX" if district_code == 10817 & election == "2010 British general election"
replace district_name = "MID WORCESTERSHIRE" if district_code == 10818 & election == "2010 British general election"
replace district_name = "MIDDLESBROUGH" if district_code == 10819 & election == "2010 British general election"
replace district_name = "MIDDLESBROUGH SOUTH AND EAST CLEVELAND" if district_code == 10820 & election == "2010 British general election"
replace district_name = "MILTON KEYNES NORTH" if district_code == 10821 & election == "2010 British general election"
replace district_name = "MILTON KEYNES SOUTH" if district_code == 10822 & election == "2010 British general election"
replace district_name = "MITCHAM AND MORDEN" if district_code == 10823 & election == "2010 British general election"
replace district_name = "MOLE VALLEY" if district_code == 10824 & election == "2010 British general election"
replace district_name = "MORECAMBE AND LUNESDALE" if district_code == 10825 & election == "2010 British general election"
replace district_name = "MORLEY AND OUTWOOD" if district_code == 10826 & election == "2010 British general election"
replace district_name = "NEW FOREST EAST" if district_code == 10827 & election == "2010 British general election"
replace district_name = "NEW FOREST WEST" if district_code == 10828 & election == "2010 British general election"
replace district_name = "NEWARK" if district_code == 10829 & election == "2010 British general election"
replace district_name = "NEWBURY" if district_code == 10830 & election == "2010 British general election"
replace district_name = "NEWCASTLE UPON TYNE CENTRAL" if district_code == 10831 & election == "2010 British general election"
replace district_name = "NEWCASTLE UPON TYNE EAST" if district_code == 10832 & election == "2010 British general election"
replace district_name = "NEWCASTLE UPON TYNE NORTH" if district_code == 10833 & election == "2010 British general election"
replace district_name = "NEWCASTLE-UNDER-LYME" if district_code == 10834 & election == "2010 British general election"
replace district_name = "NEWTON ABBOT" if district_code == 10835 & election == "2010 British general election"
replace district_name = "NORMANTON, PONTEFRACT AND CASTLEFORD" if district_code == 10836 & election == "2010 British general election"
replace district_name = "NORTH CORNWALL" if district_code == 10837 & election == "2010 British general election"
replace district_name = "NORTH DEVON" if district_code == 10838 & election == "2010 British general election"
replace district_name = "NORTH DORSET" if district_code == 10839 & election == "2010 British general election"
replace district_name = "NORTH DURHAM" if district_code == 10840 & election == "2010 British general election"
replace district_name = "NORTH EAST BEDFORDSHIRE" if district_code == 10841 & election == "2010 British general election"
replace district_name = "NORTH EAST CAMBRIDGESHIRE" if district_code == 10842 & election == "2010 British general election"
replace district_name = "NORTH EAST DERBYSHIRE" if district_code == 10843 & election == "2010 British general election"
replace district_name = "NORTH EAST HAMPSHIRE" if district_code == 10844 & election == "2010 British general election"
replace district_name = "NORTH EAST HERTFORDSHIRE" if district_code == 10845 & election == "2010 British general election"
replace district_name = "NORTH EAST SOMERSET" if district_code == 10846 & election == "2010 British general election"
replace district_name = "NORTH HEREFORDSHIRE" if district_code == 10847 & election == "2010 British general election"
replace district_name = "NORTH NORFOLK" if district_code == 10848 & election == "2010 British general election"
replace district_name = "NORTH SHROPSHIRE" if district_code == 10849 & election == "2010 British general election"
replace district_name = "NORTH SOMERSET" if district_code == 10850 & election == "2010 British general election"
replace district_name = "NORTH SWINDON" if district_code == 10851 & election == "2010 British general election"
replace district_name = "NORTH THANET" if district_code == 10852 & election == "2010 British general election"
replace district_name = "NORTH TYNESIDE" if district_code == 10853 & election == "2010 British general election"
replace district_name = "NORTH WARWICKSHIRE" if district_code == 10854 & election == "2010 British general election"
replace district_name = "NORTH WEST CAMBRIDGESHIRE" if district_code == 10855 & election == "2010 British general election"
replace district_name = "NORTH WEST DURHAM" if district_code == 10856 & election == "2010 British general election"
replace district_name = "NORTH WEST HAMPSHIRE" if district_code == 10857 & election == "2010 British general election"
replace district_name = "NORTH WEST LEICESTERSHIRE" if district_code == 10858 & election == "2010 British general election"
replace district_name = "NORTH WEST NORFOLK" if district_code == 10859 & election == "2010 British general election"
replace district_name = "NORTH WILTSHIRE" if district_code == 10860 & election == "2010 British general election"
replace district_name = "NORTHAMPTON NORTH" if district_code == 10861 & election == "2010 British general election"
replace district_name = "NORTHAMPTON SOUTH" if district_code == 10862 & election == "2010 British general election"
replace district_name = "NORWICH NORTH" if district_code == 10863 & election == "2010 British general election"
replace district_name = "NORWICH SOUTH" if district_code == 10864 & election == "2010 British general election"
replace district_name = "NOTTINGHAM EAST" if district_code == 10865 & election == "2010 British general election"
replace district_name = "NOTTINGHAM NORTH" if district_code == 10866 & election == "2010 British general election"
replace district_name = "NOTTINGHAM SOUTH" if district_code == 10867 & election == "2010 British general election"
replace district_name = "NUNEATON" if district_code == 10868 & election == "2010 British general election"
replace district_name = "OLD BEXLEY AND SIDCUP" if district_code == 10869 & election == "2010 British general election"
replace district_name = "OLDHAM EAST AND SADDLEWORTH" if district_code == 10870 & election == "2010 British general election"
replace district_name = "OLDHAM WEST AND ROYTON" if district_code == 10871 & election == "2010 British general election"
replace district_name = "ORPINGTON" if district_code == 10872 & election == "2010 British general election"
replace district_name = "OXFORD EAST" if district_code == 10873 & election == "2010 British general election"
replace district_name = "OXFORD WEST AND ABINGDON" if district_code == 10874 & election == "2010 British general election"
replace district_name = "PENDLE" if district_code == 10875 & election == "2010 British general election"
replace district_name = "PENISTONE AND STOCKSBRIDGE" if district_code == 10876 & election == "2010 British general election"
replace district_name = "PENRITH AND THE BORDER" if district_code == 10877 & election == "2010 British general election"
replace district_name = "PETERBOROUGH" if district_code == 10878 & election == "2010 British general election"
replace district_name = "PLYMOUTH, MOOR VIEW" if district_code == 10879 & election == "2010 British general election"
replace district_name = "PLYMOUTH, SUTTON AND DEVONPORT" if district_code == 10880 & election == "2010 British general election"
replace district_name = "POOLE" if district_code == 10881 & election == "2010 British general election"
replace district_name = "POPLAR AND LIMEHOUSE" if district_code == 10882 & election == "2010 British general election"
replace district_name = "PORTSMOUTH NORTH" if district_code == 10883 & election == "2010 British general election"
replace district_name = "PORTSMOUTH SOUTH" if district_code == 10884 & election == "2010 British general election"
replace district_name = "PRESTON" if district_code == 10885 & election == "2010 British general election"
replace district_name = "PUDSEY" if district_code == 10886 & election == "2010 British general election"
replace district_name = "PUTNEY" if district_code == 10887 & election == "2010 British general election"
replace district_name = "RAYLEIGH AND WICKFORD" if district_code == 10888 & election == "2010 British general election"
replace district_name = "READING EAST" if district_code == 10889 & election == "2010 British general election"
replace district_name = "READING WEST" if district_code == 10890 & election == "2010 British general election"
replace district_name = "REDCAR" if district_code == 10891 & election == "2010 British general election"
replace district_name = "REDDITCH" if district_code == 10892 & election == "2010 British general election"
replace district_name = "REIGATE" if district_code == 10893 & election == "2010 British general election"
replace district_name = "RIBBLE VALLEY" if district_code == 10894 & election == "2010 British general election"
replace district_name = "RICHMOND (YORKS)" if district_code == 10895 & election == "2010 British general election"
replace district_name = "RICHMOND PARK" if district_code == 10896 & election == "2010 British general election"
replace district_name = "ROCHDALE" if district_code == 10897 & election == "2010 British general election"
replace district_name = "ROCHESTER AND STROOD" if district_code == 10898 & election == "2010 British general election"
replace district_name = "ROCHFORD AND SOUTHEND EAST" if district_code == 10899 & election == "2010 British general election"
replace district_name = "ROMFORD" if district_code == 10900 & election == "2010 British general election"
replace district_name = "ROMSEY AND SOUTHAMPTON NORTH" if district_code == 10901 & election == "2010 British general election"
replace district_name = "ROSSENDALE AND DARWEN" if district_code == 10902 & election == "2010 British general election"
replace district_name = "ROTHER VALLEY" if district_code == 10903 & election == "2010 British general election"
replace district_name = "ROTHERHAM" if district_code == 10904 & election == "2010 British general election"
replace district_name = "RUGBY" if district_code == 10905 & election == "2010 British general election"
replace district_name = "RUISLIP, NORTHWOOD AND PINNER" if district_code == 10906 & election == "2010 British general election"
replace district_name = "RUNNYMEDE AND WEYBRIDGE" if district_code == 10907 & election == "2010 British general election"
replace district_name = "RUSHCLIFFE" if district_code == 10908 & election == "2010 British general election"
replace district_name = "RUTLAND AND MELTON" if district_code == 10909 & election == "2010 British general election"
replace district_name = "SAFFRON WALDEN" if district_code == 10910 & election == "2010 British general election"
replace district_name = "SALFORD AND ECCLES" if district_code == 10911 & election == "2010 British general election"
replace district_name = "SALISBURY" if district_code == 10912 & election == "2010 British general election"
replace district_name = "SCARBOROUGH AND WHITBY" if district_code == 10913 & election == "2010 British general election"
replace district_name = "SCUNTHORPE" if district_code == 10914 & election == "2010 British general election"
replace district_name = "SEDGEFIELD" if district_code == 10915 & election == "2010 British general election"
replace district_name = "SEFTON CENTRAL" if district_code == 10916 & election == "2010 British general election"
replace district_name = "SELBY AND AINSTY" if district_code == 10917 & election == "2010 British general election"
replace district_name = "SEVENOAKS" if district_code == 10918 & election == "2010 British general election"
replace district_name = "SHEFFIELD CENTRAL" if district_code == 10919 & election == "2010 British general election"
replace district_name = "SHEFFIELD SOUTH EAST" if district_code == 10920 & election == "2010 British general election"
replace district_name = "SHEFFIELD, BRIGHTSIDE AND HILLSBOROUGH" if district_code == 10921 & election == "2010 British general election"
replace district_name = "SHEFFIELD, HALLAM" if district_code == 10922 & election == "2010 British general election"
replace district_name = "SHEFFIELD, HEELEY" if district_code == 10923 & election == "2010 British general election"
replace district_name = "SHERWOOD" if district_code == 10924 & election == "2010 British general election"
replace district_name = "SHIPLEY" if district_code == 10925 & election == "2010 British general election"
replace district_name = "SHREWSBURY AND ATCHAM" if district_code == 10926 & election == "2010 British general election"
replace district_name = "SITTINGBOURNE AND SHEPPEY" if district_code == 10927 & election == "2010 British general election"
replace district_name = "SKIPTON AND RIPON" if district_code == 10928 & election == "2010 British general election"
replace district_name = "SLEAFORD AND NORTH HYKEHAM" if district_code == 10929 & election == "2010 British general election"
replace district_name = "SLOUGH" if district_code == 10930 & election == "2010 British general election"
replace district_name = "SOLIHULL" if district_code == 10931 & election == "2010 British general election"
replace district_name = "SOMERTON AND FROME" if district_code == 10932 & election == "2010 British general election"
replace district_name = "SOUTH BASILDON AND EAST THURROCK" if district_code == 10933 & election == "2010 British general election"
replace district_name = "SOUTH CAMBRIDGESHIRE" if district_code == 10934 & election == "2010 British general election"
replace district_name = "SOUTH DERBYSHIRE" if district_code == 10935 & election == "2010 British general election"
replace district_name = "SOUTH DORSET" if district_code == 10936 & election == "2010 British general election"
replace district_name = "SOUTH EAST CAMBRIDGESHIRE" if district_code == 10937 & election == "2010 British general election"
replace district_name = "SOUTH EAST CORNWALL" if district_code == 10938 & election == "2010 British general election"
replace district_name = "SOUTH HOLLAND AND THE DEEPINGS" if district_code == 10939 & election == "2010 British general election"
replace district_name = "SOUTH LEICESTERSHIRE" if district_code == 10940 & election == "2010 British general election"
replace district_name = "SOUTH NORFOLK" if district_code == 10941 & election == "2010 British general election"
replace district_name = "SOUTH NORTHAMPTONSHIRE" if district_code == 10942 & election == "2010 British general election"
replace district_name = "SOUTH RIBBLE" if district_code == 10943 & election == "2010 British general election"
replace district_name = "SOUTH SHIELDS" if district_code == 10944 & election == "2010 British general election"
replace district_name = "SOUTH STAFFORDSHIRE" if district_code == 10945 & election == "2010 British general election"
replace district_name = "SOUTH SUFFOLK" if district_code == 10946 & election == "2010 British general election"
replace district_name = "SOUTH SWINDON" if district_code == 10947 & election == "2010 British general election"
replace district_name = "SOUTH THANET" if district_code == 10948 & election == "2010 British general election"
replace district_name = "SOUTH WEST BEDFORDSHIRE" if district_code == 10949 & election == "2010 British general election"
replace district_name = "SOUTH WEST DEVON" if district_code == 10950 & election == "2010 British general election"
replace district_name = "SOUTH WEST HERTFORDSHIRE" if district_code == 10951 & election == "2010 British general election"
replace district_name = "SOUTH WEST NORFOLK" if district_code == 10952 & election == "2010 British general election"
replace district_name = "SOUTH WEST SURREY" if district_code == 10953 & election == "2010 British general election"
replace district_name = "SOUTH WEST WILTSHIRE" if district_code == 10954 & election == "2010 British general election"
replace district_name = "SOUTHAMPTON, ITCHEN" if district_code == 10955 & election == "2010 British general election"
replace district_name = "SOUTHAMPTON, TEST" if district_code == 10956 & election == "2010 British general election"
replace district_name = "SOUTHEND WEST" if district_code == 10957 & election == "2010 British general election"
replace district_name = "SOUTHPORT" if district_code == 10958 & election == "2010 British general election"
replace district_name = "SPELTHORNE" if district_code == 10959 & election == "2010 British general election"
replace district_name = "ST ALBANS" if district_code == 10960 & election == "2010 British general election"
replace district_name = "ST AUSTELL AND NEWQUAY" if district_code == 10961 & election == "2010 British general election"
replace district_name = "ST HELENS NORTH" if district_code == 10962 & election == "2010 British general election"
replace district_name = "ST HELENS SOUTH AND WHISTON" if district_code == 10963 & election == "2010 British general election"
replace district_name = "ST IVES" if district_code == 10964 & election == "2010 British general election"
replace district_name = "STAFFORD" if district_code == 10965 & election == "2010 British general election"
replace district_name = "STAFFORDSHIRE MOORLANDS" if district_code == 10966 & election == "2010 British general election"
replace district_name = "STALYBRIDGE AND HYDE" if district_code == 10967 & election == "2010 British general election"
replace district_name = "STEVENAGE" if district_code == 10968 & election == "2010 British general election"
replace district_name = "STOCKPORT" if district_code == 10969 & election == "2010 British general election"
replace district_name = "STOCKTON NORTH" if district_code == 10970 & election == "2010 British general election"
replace district_name = "STOCKTON SOUTH" if district_code == 10971 & election == "2010 British general election"
replace district_name = "STOKE-ON-TRENT CENTRAL" if district_code == 10972 & election == "2010 British general election"
replace district_name = "STOKE-ON-TRENT NORTH" if district_code == 10973 & election == "2010 British general election"
replace district_name = "STOKE-ON-TRENT SOUTH" if district_code == 10974 & election == "2010 British general election"
replace district_name = "STONE" if district_code == 10975 & election == "2010 British general election"
replace district_name = "STOURBRIDGE" if district_code == 10976 & election == "2010 British general election"
replace district_name = "STRATFORD-ON-AVON" if district_code == 10977 & election == "2010 British general election"
replace district_name = "STREATHAM" if district_code == 10978 & election == "2010 British general election"
replace district_name = "STRETFORD AND URMSTON" if district_code == 10979 & election == "2010 British general election"
replace district_name = "STROUD" if district_code == 10980 & election == "2010 British general election"
replace district_name = "SUFFOLK COASTAL" if district_code == 10981 & election == "2010 British general election"
replace district_name = "SUNDERLAND CENTRAL" if district_code == 10982 & election == "2010 British general election"
replace district_name = "SURREY HEATH" if district_code == 10983 & election == "2010 British general election"
replace district_name = "SUTTON AND CHEAM" if district_code == 10984 & election == "2010 British general election"
replace district_name = "SUTTON COLDFIELD" if district_code == 10985 & election == "2010 British general election"
replace district_name = "TAMWORTH" if district_code == 10986 & election == "2010 British general election"
replace district_name = "TATTON" if district_code == 10987 & election == "2010 British general election"
replace district_name = "TAUNTON DEANE" if district_code == 10988 & election == "2010 British general election"
replace district_name = "TELFORD" if district_code == 10989 & election == "2010 British general election"
replace district_name = "TEWKESBURY" if district_code == 10990 & election == "2010 British general election"
replace district_name = "THE COTSWOLDS" if district_code == 10991 & election == "2010 British general election"
replace district_name = "THE WREKIN" if district_code == 10992 & election == "2010 British general election"
replace district_name = "THIRSK AND MALTON" if district_code == 10993 & election == "2010 British general election"
replace district_name = "THORNBURY AND YATE" if district_code == 10994 & election == "2010 British general election"
replace district_name = "THURROCK" if district_code == 10995 & election == "2010 British general election"
replace district_name = "TIVERTON AND HONITON" if district_code == 10996 & election == "2010 British general election"
replace district_name = "TONBRIDGE AND MALLING" if district_code == 10997 & election == "2010 British general election"
replace district_name = "TOOTING" if district_code == 10998 & election == "2010 British general election"
replace district_name = "TORBAY" if district_code == 10999 & election == "2010 British general election"
replace district_name = "TORRIDGE AND WEST DEVON" if district_code == 11000 & election == "2010 British general election"
replace district_name = "TOTNES" if district_code == 11001 & election == "2010 British general election"
replace district_name = "TOTTENHAM" if district_code == 11002 & election == "2010 British general election"
replace district_name = "TRURO AND FALMOUTH" if district_code == 11003 & election == "2010 British general election"
replace district_name = "TUNBRIDGE WELLS" if district_code == 11004 & election == "2010 British general election"
replace district_name = "TWICKENHAM" if district_code == 11005 & election == "2010 British general election"
replace district_name = "TYNEMOUTH" if district_code == 11006 & election == "2010 British general election"
replace district_name = "UXBRIDGE AND SOUTH RUISLIP" if district_code == 11007 & election == "2010 British general election"
replace district_name = "VAUXHALL" if district_code == 11008 & election == "2010 British general election"
replace district_name = "WAKEFIELD" if district_code == 11009 & election == "2010 British general election"
replace district_name = "WALLASEY" if district_code == 11010 & election == "2010 British general election"
replace district_name = "WALSALL NORTH" if district_code == 11011 & election == "2010 British general election"
replace district_name = "WALSALL SOUTH" if district_code == 11012 & election == "2010 British general election"
replace district_name = "WALTHAMSTOW" if district_code == 11013 & election == "2010 British general election"
replace district_name = "WANSBECK" if district_code == 11014 & election == "2010 British general election"
replace district_name = "WANTAGE" if district_code == 11015 & election == "2010 British general election"
replace district_name = "WARLEY" if district_code == 11016 & election == "2010 British general election"
replace district_name = "WARRINGTON NORTH" if district_code == 11017 & election == "2010 British general election"
replace district_name = "WARRINGTON SOUTH" if district_code == 11018 & election == "2010 British general election"
replace district_name = "WARWICK AND LEAMINGTON" if district_code == 11019 & election == "2010 British general election"
replace district_name = "WASHINGTON AND SUNDERLAND WEST" if district_code == 11020 & election == "2010 British general election"
replace district_name = "WATFORD" if district_code == 11021 & election == "2010 British general election"
replace district_name = "WAVENEY" if district_code == 11022 & election == "2010 British general election"
replace district_name = "WEALDEN" if district_code == 11023 & election == "2010 British general election"
replace district_name = "WEAVER VALE" if district_code == 11024 & election == "2010 British general election"
replace district_name = "WELLINGBOROUGH" if district_code == 11025 & election == "2010 British general election"
replace district_name = "WELLS" if district_code == 11026 & election == "2010 British general election"
replace district_name = "WELWYN HATFIELD" if district_code == 11027 & election == "2010 British general election"
replace district_name = "WENTWORTH AND DEARNE" if district_code == 11028 & election == "2010 British general election"
replace district_name = "WEST BROMWICH EAST" if district_code == 11029 & election == "2010 British general election"
replace district_name = "WEST BROMWICH WEST" if district_code == 11030 & election == "2010 British general election"
replace district_name = "WEST DORSET" if district_code == 11031 & election == "2010 British general election"
replace district_name = "WEST HAM" if district_code == 11032 & election == "2010 British general election"
replace district_name = "WEST LANCASHIRE" if district_code == 11033 & election == "2010 British general election"
replace district_name = "WEST SUFFOLK" if district_code == 11034 & election == "2010 British general election"
replace district_name = "WEST WORCESTERSHIRE" if district_code == 11035 & election == "2010 British general election"
replace district_name = "WESTMINSTER NORTH" if district_code == 11036 & election == "2010 British general election"
replace district_name = "WESTMORLAND AND LONSDALE" if district_code == 11037 & election == "2010 British general election"
replace district_name = "WESTON-SUPER-MARE" if district_code == 11038 & election == "2010 British general election"
replace district_name = "WIGAN" if district_code == 11039 & election == "2010 British general election"
replace district_name = "WIMBLEDON" if district_code == 11040 & election == "2010 British general election"
replace district_name = "WINCHESTER" if district_code == 11041 & election == "2010 British general election"
replace district_name = "WINDSOR" if district_code == 11042 & election == "2010 British general election"
replace district_name = "WIRRAL SOUTH" if district_code == 11043 & election == "2010 British general election"
replace district_name = "WIRRAL WEST" if district_code == 11044 & election == "2010 British general election"
replace district_name = "WITHAM" if district_code == 11045 & election == "2010 British general election"
replace district_name = "WITNEY" if district_code == 11046 & election == "2010 British general election"
replace district_name = "WOKING" if district_code == 11047 & election == "2010 British general election"
replace district_name = "WOKINGHAM" if district_code == 11048 & election == "2010 British general election"
replace district_name = "WOLVERHAMPTON NORTH EAST" if district_code == 11049 & election == "2010 British general election"
replace district_name = "WOLVERHAMPTON SOUTH EAST" if district_code == 11050 & election == "2010 British general election"
replace district_name = "WOLVERHAMPTON SOUTH WEST" if district_code == 11051 & election == "2010 British general election"
replace district_name = "WORCESTER" if district_code == 11052 & election == "2010 British general election"
replace district_name = "WORKINGTON" if district_code == 11053 & election == "2010 British general election"
replace district_name = "WORSLEY AND ECCLES SOUTH" if district_code == 11054 & election == "2010 British general election"
replace district_name = "WORTHING WEST" if district_code == 11055 & election == "2010 British general election"
replace district_name = "WYCOMBE" if district_code == 11056 & election == "2010 British general election"
replace district_name = "WYRE AND PRESTON NORTH" if district_code == 11057 & election == "2010 British general election"
replace district_name = "WYRE FOREST" if district_code == 11058 & election == "2010 British general election"
replace district_name = "WYTHENSHAWE AND SALE EAST" if district_code == 11059 & election == "2010 British general election"
replace district_name = "YEOVIL" if district_code == 11060 & election == "2010 British general election"
replace district_name = "YORK CENTRAL" if district_code == 11061 & election == "2010 British general election"
replace district_name = "YORK OUTER" if district_code == 11062 & election == "2010 British general election"
replace district_name = "BELFAST EAST" if district_code == 40001 & election == "2010 British general election"
replace district_name = "BELFAST NORTH" if district_code == 40002 & election == "2010 British general election"
replace district_name = "BELFAST SOUTH" if district_code == 40003 & election == "2010 British general election"
replace district_name = "BELFAST WEST" if district_code == 40004 & election == "2010 British general election"
replace district_name = "EAST ANTRIM" if district_code == 40005 & election == "2010 British general election"
replace district_name = "EAST LONDONDERRY" if district_code == 40006 & election == "2010 British general election"
replace district_name = "FERMANAGH AND SOUTH TYRONE" if district_code == 40007 & election == "2010 British general election"
replace district_name = "FOYLE" if district_code == 40008 & election == "2010 British general election"
replace district_name = "LAGAN VALLEY" if district_code == 40009 & election == "2010 British general election"
replace district_name = "MID ULSTER" if district_code == 40010 & election == "2010 British general election"
replace district_name = "NEWRY AND ARMAGH" if district_code == 40011 & election == "2010 British general election"
replace district_name = "NORTH ANTRIM" if district_code == 40012 & election == "2010 British general election"
replace district_name = "NORTH DOWN" if district_code == 40013 & election == "2010 British general election"
replace district_name = "SOUTH ANTRIM" if district_code == 40014 & election == "2010 British general election"
replace district_name = "SOUTH DOWN" if district_code == 40015 & election == "2010 British general election"
replace district_name = "STRANGFORD" if district_code == 40016 & election == "2010 British general election"
replace district_name = "UPPER BANN" if district_code == 40017 & election == "2010 British general election"
replace district_name = "WEST TYRONE" if district_code == 40018 & election == "2010 British general election"
replace district_name = "ABERDEEN NORTH" if district_code == 20001 & election == "2010 British general election"
replace district_name = "ABERDEEN SOUTH" if district_code == 20002 & election == "2010 British general election"
replace district_name = "AIRDRIE AND SHOTTS" if district_code == 20003 & election == "2010 British general election"
replace district_name = "ANGUS" if district_code == 20004 & election == "2010 British general election"
replace district_name = "ARGYLL AND BUTE" if district_code == 20005 & election == "2010 British general election"
replace district_name = "AYR, CARRICK AND CUMNOCK" if district_code == 20006 & election == "2010 British general election"
replace district_name = "BANFF AND BUCHAN" if district_code == 20007 & election == "2010 British general election"
replace district_name = "BERWICKSHIRE, ROXBURGH AND SELKIRK" if district_code == 20008 & election == "2010 British general election"
replace district_name = "CAITHNESS, SUTHERLAND AND EASTER ROSS" if district_code == 20009 & election == "2010 British general election"
replace district_name = "CENTRAL AYRSHIRE" if district_code == 20010 & election == "2010 British general election"
replace district_name = "COATBRIDGE, CHRYSTON AND BELLSHILL" if district_code == 20011 & election == "2010 British general election"
replace district_name = "CUMBERNAULD, KILSYTH AND KIRKINTILLOCH EAST" if district_code == 20012 & election == "2010 British general election"
replace district_name = "DUMFRIES AND GALLOWAY" if district_code == 20013 & election == "2010 British general election"
replace district_name = "DUMFRIESSHIRE, CLYDESDALE AND TWEEDDALE" if district_code == 20014 & election == "2010 British general election"
replace district_name = "DUNDEE EAST" if district_code == 20015 & election == "2010 British general election"
replace district_name = "DUNDEE WEST" if district_code == 20016 & election == "2010 British general election"
replace district_name = "DUNFERMLINE AND WEST FIFE" if district_code == 20017 & election == "2010 British general election"
replace district_name = "EAST DUNBARTONSHIRE" if district_code == 20018 & election == "2010 British general election"
replace district_name = "EAST KILBRIDE, STRATHAVEN AND LESMAHAGOW" if district_code == 20019 & election == "2010 British general election"
replace district_name = "EAST LOTHIAN" if district_code == 20020 & election == "2010 British general election"
replace district_name = "EAST RENFREWSHIRE" if district_code == 20021 & election == "2010 British general election"
replace district_name = "EDINBURGH EAST" if district_code == 20022 & election == "2010 British general election"
replace district_name = "EDINBURGH NORTH AND LEITH" if district_code == 20023 & election == "2010 British general election"
replace district_name = "EDINBURGH SOUTH" if district_code == 20024 & election == "2010 British general election"
replace district_name = "EDINBURGH SOUTH WEST" if district_code == 20025 & election == "2010 British general election"
replace district_name = "EDINBURGH WEST" if district_code == 20026 & election == "2010 British general election"
replace district_name = "NA H-EILEANAN AN IAR" if district_code == 20027 & election == "2010 British general election"
replace district_name = "FALKIRK" if district_code == 20028 & election == "2010 British general election"
replace district_name = "GLASGOW CENTRAL" if district_code == 20029 & election == "2010 British general election"
replace district_name = "GLASGOW EAST" if district_code == 20030 & election == "2010 British general election"
replace district_name = "GLASGOW NORTH" if district_code == 20031 & election == "2010 British general election"
replace district_name = "GLASGOW NORTH EAST" if district_code == 20032 & election == "2010 British general election"
replace district_name = "GLASGOW NORTH WEST" if district_code == 20033 & election == "2010 British general election"
replace district_name = "GLASGOW SOUTH" if district_code == 20034 & election == "2010 British general election"
replace district_name = "GLASGOW SOUTH WEST" if district_code == 20035 & election == "2010 British general election"
replace district_name = "GLENROTHES" if district_code == 20036 & election == "2010 British general election"
replace district_name = "GORDON" if district_code == 20037 & election == "2010 British general election"
replace district_name = "INVERCLYDE" if district_code == 20038 & election == "2010 British general election"
replace district_name = "INVERNESS, NAIRN, BADENOCH AND STRATHSPEY" if district_code == 20039 & election == "2010 British general election"
replace district_name = "KILMARNOCK AND LOUDOUN" if district_code == 20040 & election == "2010 British general election"
replace district_name = "KIRKCALDY AND COWDENBEATH" if district_code == 20041 & election == "2010 British general election"
replace district_name = "LANARK AND HAMILTON EAST" if district_code == 20042 & election == "2010 British general election"
replace district_name = "LINLITHGOW AND EAST FALKIRK" if district_code == 20043 & election == "2010 British general election"
replace district_name = "LIVINGSTON" if district_code == 20044 & election == "2010 British general election"
replace district_name = "MIDLOTHIAN" if district_code == 20045 & election == "2010 British general election"
replace district_name = "MORAY" if district_code == 20046 & election == "2010 British general election"
replace district_name = "MOTHERWELL AND WISHAW" if district_code == 20047 & election == "2010 British general election"
replace district_name = "NORTH AYRSHIRE AND ARRAN" if district_code == 20048 & election == "2010 British general election"
replace district_name = "NORTH EAST FIFE" if district_code == 20049 & election == "2010 British general election"
replace district_name = "OCHIL AND SOUTH PERTHSHIRE" if district_code == 20050 & election == "2010 British general election"
replace district_name = "ORKNEY AND SHETLAND" if district_code == 20051 & election == "2010 British general election"
replace district_name = "PAISLEY AND RENFREWSHIRE NORTH" if district_code == 20052 & election == "2010 British general election"
replace district_name = "PAISLEY AND RENFREWSHIRE SOUTH" if district_code == 20053 & election == "2010 British general election"
replace district_name = "PERTH AND NORTH PERTHSHIRE" if district_code == 20054 & election == "2010 British general election"
replace district_name = "ROSS, SKYE AND LOCHABER" if district_code == 20055 & election == "2010 British general election"
replace district_name = "RUTHERGLEN AND HAMILTON WEST" if district_code == 20056 & election == "2010 British general election"
replace district_name = "STIRLING" if district_code == 20057 & election == "2010 British general election"
replace district_name = "WEST ABERDEENSHIRE AND KINCARDINE" if district_code == 20058 & election == "2010 British general election"
replace district_name = "WEST DUNBARTONSHIRE" if district_code == 20059 & election == "2010 British general election"
replace district_name = "YNYS MON" if district_code == 30041 & election == "2010 British general election"
replace district_name = "DELYN" if district_code == 30042 & election == "2010 British general election"
replace district_name = "ALYN AND DEESIDE" if district_code == 30043 & election == "2010 British general election"
replace district_name = "WREXHAM" if district_code == 30044 & election == "2010 British general election"
replace district_name = "LLANELLI" if district_code == 30045 & election == "2010 British general election"
replace district_name = "GOWER" if district_code == 30046 & election == "2010 British general election"
replace district_name = "SWANSEA WEST" if district_code == 30047 & election == "2010 British general election"
replace district_name = "SWANSEA EAST" if district_code == 30048 & election == "2010 British general election"
replace district_name = "ABERAVON" if district_code == 30049 & election == "2010 British general election"
replace district_name = "CARDIFF CENTRAL" if district_code == 30050 & election == "2010 British general election"
replace district_name = "CARDIFF NORTH" if district_code == 30051 & election == "2010 British general election"
replace district_name = "RHONDDA" if district_code == 30052 & election == "2010 British general election"
replace district_name = "TORFAEN" if district_code == 30053 & election == "2010 British general election"
replace district_name = "MONMOUTH" if district_code == 30054 & election == "2010 British general election"
replace district_name = "NEWPORT EAST" if district_code == 30055 & election == "2010 British general election"
replace district_name = "NEWPORT WEST" if district_code == 30056 & election == "2010 British general election"
replace district_name = "ARFON" if district_code == 30057 & election == "2010 British general election"
replace district_name = "ABERCONWY" if district_code == 30058 & election == "2010 British general election"
replace district_name = "CLWYD WEST" if district_code == 30059 & election == "2010 British general election"
replace district_name = "VALE OF CLWYD" if district_code == 30060 & election == "2010 British general election"
replace district_name = "DWYFOR MEIRIONNYDD" if district_code == 30061 & election == "2010 British general election"
replace district_name = "CLWYD SOUTH" if district_code == 30062 & election == "2010 British general election"
replace district_name = "MONTGOMERYSHIRE" if district_code == 30063 & election == "2010 British general election"
replace district_name = "CEREDIGION" if district_code == 30064 & election == "2010 British general election"
replace district_name = "PRESELI PEMBROKESHIRE" if district_code == 30065 & election == "2010 British general election"
replace district_name = "CARMARTHEN WEST AND SOUTH PEMBROKESHIRE" if district_code == 30066 & election == "2010 British general election"
replace district_name = "CARMARTHEN EAST AND DINEFWR" if district_code == 30067 & election == "2010 British general election"
replace district_name = "BRECON AND RADNORSHIRE" if district_code == 30068 & election == "2010 British general election"
replace district_name = "NEATH" if district_code == 30069 & election == "2010 British general election"
replace district_name = "CYNON VALLEY" if district_code == 30070 & election == "2010 British general election"
replace district_name = "MERTHYR TYDFIL AND RHYMNEY" if district_code == 30071 & election == "2010 British general election"
replace district_name = "BLAENAU GWENT" if district_code == 30072 & election == "2010 British general election"
replace district_name = "BRIDGEND" if district_code == 30073 & election == "2010 British general election"
replace district_name = "OGMORE" if district_code == 30074 & election == "2010 British general election"
replace district_name = "PONTYPRIDD" if district_code == 30075 & election == "2010 British general election"
replace district_name = "CAERPHILLY" if district_code == 30076 & election == "2010 British general election"
replace district_name = "ISLWYN" if district_code == 30077 & election == "2010 British general election"
replace district_name = "VALE OF GLAMORGAN" if district_code == 30078 & election == "2010 British general election"
replace district_name = "CARDIFF WEST" if district_code == 30079 & election == "2010 British general election"
replace district_name = "CARDIFF SOUTH AND PENARTH" if district_code == 30080 & election == "2010 British general election"
replace district_name = "Aldershot" if district_code == 10530 & election == "2015 British general election"
replace district_name = "Aldridge-Brownhills" if district_code == 10531 & election == "2015 British general election"
replace district_name = "Altrincham and Sale West" if district_code == 10532 & election == "2015 British general election"
replace district_name = "Amber Valley" if district_code == 10533 & election == "2015 British general election"
replace district_name = "Arundel and South Downs" if district_code == 10534 & election == "2015 British general election"
replace district_name = "Ashfield" if district_code == 10535 & election == "2015 British general election"
replace district_name = "Ashford" if district_code == 10536 & election == "2015 British general election"
replace district_name = "Ashton-Under-Lyne" if district_code == 10537 & election == "2015 British general election"
replace district_name = "Aylesbury" if district_code == 10538 & election == "2015 British general election"
replace district_name = "Banbury" if district_code == 10539 & election == "2015 British general election"
replace district_name = "Barking" if district_code == 10540 & election == "2015 British general election"
replace district_name = "Barnsley Central" if district_code == 10541 & election == "2015 British general election"
replace district_name = "Barnsley East" if district_code == 10542 & election == "2015 British general election"
replace district_name = "Barrow and Furness" if district_code == 10543 & election == "2015 British general election"
replace district_name = "Basildon and Billericay" if district_code == 10544 & election == "2015 British general election"
replace district_name = "Basingstoke" if district_code == 10545 & election == "2015 British general election"
replace district_name = "Bassetlaw" if district_code == 10546 & election == "2015 British general election"
replace district_name = "Bath" if district_code == 10547 & election == "2015 British general election"
replace district_name = "Batley and Spen" if district_code == 10548 & election == "2015 British general election"
replace district_name = "Battersea" if district_code == 10549 & election == "2015 British general election"
replace district_name = "Beaconsfield" if district_code == 10550 & election == "2015 British general election"
replace district_name = "Beckenham" if district_code == 10551 & election == "2015 British general election"
replace district_name = "Bedford" if district_code == 10552 & election == "2015 British general election"
replace district_name = "Bermondsey and Old Southwark" if district_code == 10553 & election == "2015 British general election"
replace district_name = "Berwick-Upon-Tweed" if district_code == 10554 & election == "2015 British general election"
replace district_name = "Bethnal Green and Bow" if district_code == 10555 & election == "2015 British general election"
replace district_name = "Beverley and Holderness" if district_code == 10556 & election == "2015 British general election"
replace district_name = "Bexhill and Battle" if district_code == 10557 & election == "2015 British general election"
replace district_name = "Bexleyheath and Crayford" if district_code == 10558 & election == "2015 British general election"
replace district_name = "Birkenhead" if district_code == 10559 & election == "2015 British general election"
replace district_name = "Bishop Auckland" if district_code == 10569 & election == "2015 British general election"
replace district_name = "Blackburn" if district_code == 10570 & election == "2015 British general election"
replace district_name = "Blackley and Broughton" if district_code == 10571 & election == "2015 British general election"
replace district_name = "Blackpool North and Cleveleys" if district_code == 10572 & election == "2015 British general election"
replace district_name = "Blackpool South" if district_code == 10573 & election == "2015 British general election"
replace district_name = "Blaydon" if district_code == 10574 & election == "2015 British general election"
replace district_name = "Blyth Valley" if district_code == 10575 & election == "2015 British general election"
replace district_name = "Bognor Regis and Littlehampton" if district_code == 10576 & election == "2015 British general election"
replace district_name = "Bolsover" if district_code == 10577 & election == "2015 British general election"
replace district_name = "Bolton North East" if district_code == 10578 & election == "2015 British general election"
replace district_name = "Bolton South East" if district_code == 10579 & election == "2015 British general election"
replace district_name = "Bolton West" if district_code == 10580 & election == "2015 British general election"
replace district_name = "Bootle" if district_code == 10581 & election == "2015 British general election"
replace district_name = "Boston and Skegness" if district_code == 10582 & election == "2015 British general election"
replace district_name = "Bosworth" if district_code == 10583 & election == "2015 British general election"
replace district_name = "Bournemouth East" if district_code == 10584 & election == "2015 British general election"
replace district_name = "Bournemouth West" if district_code == 10585 & election == "2015 British general election"
replace district_name = "Bracknell" if district_code == 10586 & election == "2015 British general election"
replace district_name = "Bradford East" if district_code == 10587 & election == "2015 British general election"
replace district_name = "Bradford South" if district_code == 10588 & election == "2015 British general election"
replace district_name = "Bradford West" if district_code == 10589 & election == "2015 British general election"
replace district_name = "Braintree" if district_code == 10590 & election == "2015 British general election"
replace district_name = "Brent Central" if district_code == 10591 & election == "2015 British general election"
replace district_name = "Brent North" if district_code == 10592 & election == "2015 British general election"
replace district_name = "Brentford and Isleworth" if district_code == 10593 & election == "2015 British general election"
replace district_name = "Brentwood and Ongar" if district_code == 10594 & election == "2015 British general election"
replace district_name = "Bridgwater and West Somerset" if district_code == 10595 & election == "2015 British general election"
replace district_name = "Brigg and Goole" if district_code == 10596 & election == "2015 British general election"
replace district_name = "Bristol East" if district_code == 10599 & election == "2015 British general election"
replace district_name = "Bristol North West" if district_code == 10600 & election == "2015 British general election"
replace district_name = "Bristol South" if district_code == 10601 & election == "2015 British general election"
replace district_name = "Bristol West" if district_code == 10602 & election == "2015 British general election"
replace district_name = "Broadland" if district_code == 10603 & election == "2015 British general election"
replace district_name = "Bromley and Chislehurst" if district_code == 10604 & election == "2015 British general election"
replace district_name = "Bromsgrove" if district_code == 10605 & election == "2015 British general election"
replace district_name = "Broxbourne" if district_code == 10606 & election == "2015 British general election"
replace district_name = "Broxtowe" if district_code == 10607 & election == "2015 British general election"
replace district_name = "Buckingham" if district_code == 10608 & election == "2015 British general election"
replace district_name = "Burnley" if district_code == 10609 & election == "2015 British general election"
replace district_name = "Burton" if district_code == 10610 & election == "2015 British general election"
replace district_name = "Bury North" if district_code == 10611 & election == "2015 British general election"
replace district_name = "Bury South" if district_code == 10612 & election == "2015 British general election"
replace district_name = "Bury St Edmunds" if district_code == 10613 & election == "2015 British general election"
replace district_name = "Calder Valley" if district_code == 10614 & election == "2015 British general election"
replace district_name = "Camberwell and Peckham" if district_code == 10615 & election == "2015 British general election"
replace district_name = "Camborne and Redruth" if district_code == 10616 & election == "2015 British general election"
replace district_name = "Cambridge" if district_code == 10617 & election == "2015 British general election"
replace district_name = "Cannock Chase" if district_code == 10618 & election == "2015 British general election"
replace district_name = "Canterbury" if district_code == 10619 & election == "2015 British general election"
replace district_name = "Carlisle" if district_code == 10620 & election == "2015 British general election"
replace district_name = "Carshalton and Wallington" if district_code == 10621 & election == "2015 British general election"
replace district_name = "Castle Point" if district_code == 10622 & election == "2015 British general election"
replace district_name = "Central Devon" if district_code == 10623 & election == "2015 British general election"
replace district_name = "Central Suffolk and North Ipswich" if district_code == 10624 & election == "2015 British general election"
replace district_name = "Charnwood" if district_code == 10625 & election == "2015 British general election"
replace district_name = "Chatham and Aylesford" if district_code == 10626 & election == "2015 British general election"
replace district_name = "Cheadle" if district_code == 10627 & election == "2015 British general election"
replace district_name = "Chelmsford" if district_code == 10628 & election == "2015 British general election"
replace district_name = "Chelsea and Fulham" if district_code == 10629 & election == "2015 British general election"
replace district_name = "Cheltenham" if district_code == 10630 & election == "2015 British general election"
replace district_name = "Chesham and Amersham" if district_code == 10631 & election == "2015 British general election"
replace district_name = "Chesterfield" if district_code == 10632 & election == "2015 British general election"
replace district_name = "Chichester" if district_code == 10633 & election == "2015 British general election"
replace district_name = "Chingford and Woodford Green" if district_code == 10634 & election == "2015 British general election"
replace district_name = "Chippenham" if district_code == 10635 & election == "2015 British general election"
replace district_name = "Chipping Barnet" if district_code == 10636 & election == "2015 British general election"
replace district_name = "Chorley" if district_code == 10637 & election == "2015 British general election"
replace district_name = "Christchurch" if district_code == 10638 & election == "2015 British general election"
replace district_name = "Cities Of London and Westminster" if district_code == 10639 & election == "2015 British general election"
replace district_name = "City Of Chester" if district_code == 10640 & election == "2015 British general election"
replace district_name = "City Of Durham" if district_code == 10641 & election == "2015 British general election"
replace district_name = "Clacton" if district_code == 10642 & election == "2015 British general election"
replace district_name = "Cleethorpes" if district_code == 10643 & election == "2015 British general election"
replace district_name = "Colchester" if district_code == 10644 & election == "2015 British general election"
replace district_name = "Colne Valley" if district_code == 10645 & election == "2015 British general election"
replace district_name = "Congleton" if district_code == 10646 & election == "2015 British general election"
replace district_name = "Copeland" if district_code == 10647 & election == "2015 British general election"
replace district_name = "Corby" if district_code == 10648 & election == "2015 British general election"
replace district_name = "Coventry North East" if district_code == 10649 & election == "2015 British general election"
replace district_name = "Coventry North West" if district_code == 10650 & election == "2015 British general election"
replace district_name = "Coventry South" if district_code == 10651 & election == "2015 British general election"
replace district_name = "Crawley" if district_code == 10652 & election == "2015 British general election"
replace district_name = "Crewe and Nantwich" if district_code == 10653 & election == "2015 British general election"
replace district_name = "Croydon Central" if district_code == 10654 & election == "2015 British general election"
replace district_name = "Croydon North" if district_code == 10655 & election == "2015 British general election"
replace district_name = "Croydon South" if district_code == 10656 & election == "2015 British general election"
replace district_name = "Dagenham and Rainham" if district_code == 10657 & election == "2015 British general election"
replace district_name = "Darlington" if district_code == 10658 & election == "2015 British general election"
replace district_name = "Dartford" if district_code == 10659 & election == "2015 British general election"
replace district_name = "Daventry" if district_code == 10660 & election == "2015 British general election"
replace district_name = "Denton and Reddish" if district_code == 10661 & election == "2015 British general election"
replace district_name = "Derby North" if district_code == 10662 & election == "2015 British general election"
replace district_name = "Derby South" if district_code == 10663 & election == "2015 British general election"
replace district_name = "Derbyshire Dales" if district_code == 10664 & election == "2015 British general election"
replace district_name = "Devizes" if district_code == 10665 & election == "2015 British general election"
replace district_name = "Dewsbury" if district_code == 10666 & election == "2015 British general election"
replace district_name = "Don Valley" if district_code == 10667 & election == "2015 British general election"
replace district_name = "Doncaster Central" if district_code == 10668 & election == "2015 British general election"
replace district_name = "Doncaster North" if district_code == 10669 & election == "2015 British general election"
replace district_name = "Dover" if district_code == 10670 & election == "2015 British general election"
replace district_name = "Dudley North" if district_code == 10671 & election == "2015 British general election"
replace district_name = "Dudley South" if district_code == 10672 & election == "2015 British general election"
replace district_name = "Dulwich and West Norwood" if district_code == 10673 & election == "2015 British general election"
replace district_name = "Ealing Central and Acton" if district_code == 10674 & election == "2015 British general election"
replace district_name = "Ealing North" if district_code == 10675 & election == "2015 British general election"
replace district_name = "Easington" if district_code == 10677 & election == "2015 British general election"
replace district_name = "East Devon" if district_code == 10678 & election == "2015 British general election"
replace district_name = "East Ham" if district_code == 10679 & election == "2015 British general election"
replace district_name = "East Hampshire" if district_code == 10680 & election == "2015 British general election"
replace district_name = "East Surrey" if district_code == 10681 & election == "2015 British general election"
replace district_name = "East Worthing and Shoreham" if district_code == 10682 & election == "2015 British general election"
replace district_name = "East Yorkshire" if district_code == 10683 & election == "2015 British general election"
replace district_name = "Eastbourne" if district_code == 10684 & election == "2015 British general election"
replace district_name = "Eastleigh" if district_code == 10685 & election == "2015 British general election"
replace district_name = "Eddisbury" if district_code == 10686 & election == "2015 British general election"
replace district_name = "Edmonton" if district_code == 10687 & election == "2015 British general election"
replace district_name = "Ellesmere Port and Neston" if district_code == 10688 & election == "2015 British general election"
replace district_name = "Elmet and Rothwell" if district_code == 10689 & election == "2015 British general election"
replace district_name = "Eltham" if district_code == 10690 & election == "2015 British general election"
replace district_name = "Enfield North" if district_code == 10691 & election == "2015 British general election"
replace district_name = "Epping Forest" if district_code == 10693 & election == "2015 British general election"
replace district_name = "Epsom and Ewell" if district_code == 10694 & election == "2015 British general election"
replace district_name = "Erewash" if district_code == 10695 & election == "2015 British general election"
replace district_name = "Erith and Thamesmead" if district_code == 10696 & election == "2015 British general election"
replace district_name = "Esher and Walton" if district_code == 10697 & election == "2015 British general election"
replace district_name = "Exeter" if district_code == 10698 & election == "2015 British general election"
replace district_name = "Fareham" if district_code == 10699 & election == "2015 British general election"
replace district_name = "Faversham and Mid Kent" if district_code == 10700 & election == "2015 British general election"
replace district_name = "Feltham and Heston" if district_code == 10701 & election == "2015 British general election"
replace district_name = "Filton and Bradley Stoke" if district_code == 10702 & election == "2015 British general election"
replace district_name = "Finchley and Golders Green" if district_code == 10703 & election == "2015 British general election"
replace district_name = "Folkestone and Hythe" if district_code == 10704 & election == "2015 British general election"
replace district_name = "Forest Of Dean" if district_code == 10705 & election == "2015 British general election"
replace district_name = "Fylde" if district_code == 10706 & election == "2015 British general election"
replace district_name = "Gainsborough" if district_code == 10707 & election == "2015 British general election"
replace district_name = "Garston and Halewood" if district_code == 10708 & election == "2015 British general election"
replace district_name = "Gateshead" if district_code == 10709 & election == "2015 British general election"
replace district_name = "Gedling" if district_code == 10710 & election == "2015 British general election"
replace district_name = "Gillingham and Rainham" if district_code == 10711 & election == "2015 British general election"
replace district_name = "Gloucester" if district_code == 10712 & election == "2015 British general election"
replace district_name = "Gosport" if district_code == 10713 & election == "2015 British general election"
replace district_name = "Grantham and Stamford" if district_code == 10714 & election == "2015 British general election"
replace district_name = "Gravesham" if district_code == 10715 & election == "2015 British general election"
replace district_name = "Great Grimsby" if district_code == 10716 & election == "2015 British general election"
replace district_name = "Great Yarmouth" if district_code == 10717 & election == "2015 British general election"
replace district_name = "Greenwich and Woolwich" if district_code == 10718 & election == "2015 British general election"
replace district_name = "Guildford" if district_code == 10719 & election == "2015 British general election"
replace district_name = "Hackney North and Stoke Newington" if district_code == 10720 & election == "2015 British general election"
replace district_name = "Hackney South and Shoreditch" if district_code == 10721 & election == "2015 British general election"
replace district_name = "Halesowen and Rowley Regis" if district_code == 10722 & election == "2015 British general election"
replace district_name = "Halifax" if district_code == 10723 & election == "2015 British general election"
replace district_name = "Haltemprice and Howden" if district_code == 10724 & election == "2015 British general election"
replace district_name = "Halton" if district_code == 10725 & election == "2015 British general election"
replace district_name = "Hammersmith" if district_code == 10726 & election == "2015 British general election"
replace district_name = "Hampstead and Kilburn" if district_code == 10727 & election == "2015 British general election"
replace district_name = "Harborough" if district_code == 10728 & election == "2015 British general election"
replace district_name = "Harlow" if district_code == 10729 & election == "2015 British general election"
replace district_name = "Harrogate and Knaresborough" if district_code == 10730 & election == "2015 British general election"
replace district_name = "Harrow East" if district_code == 10731 & election == "2015 British general election"
replace district_name = "Harrow West" if district_code == 10732 & election == "2015 British general election"
replace district_name = "Hartlepool" if district_code == 10733 & election == "2015 British general election"
replace district_name = "Harwich and North Essex" if district_code == 10734 & election == "2015 British general election"
replace district_name = "Hastings and Rye" if district_code == 10735 & election == "2015 British general election"
replace district_name = "Havant" if district_code == 10736 & election == "2015 British general election"
replace district_name = "Hayes and Harlington" if district_code == 10737 & election == "2015 British general election"
replace district_name = "Hazel Grove" if district_code == 10738 & election == "2015 British general election"
replace district_name = "Hemel Hempstead" if district_code == 10739 & election == "2015 British general election"
replace district_name = "Hemsworth" if district_code == 10740 & election == "2015 British general election"
replace district_name = "Hendon" if district_code == 10741 & election == "2015 British general election"
replace district_name = "Henley" if district_code == 10742 & election == "2015 British general election"
replace district_name = "Hereford and South Herefordshire" if district_code == 10743 & election == "2015 British general election"
replace district_name = "Hertford and Stortford" if district_code == 10744 & election == "2015 British general election"
replace district_name = "Hertsmere" if district_code == 10745 & election == "2015 British general election"
replace district_name = "Hexham" if district_code == 10746 & election == "2015 British general election"
replace district_name = "Heywood and Middleton" if district_code == 10747 & election == "2015 British general election"
replace district_name = "High Peak" if district_code == 10748 & election == "2015 British general election"
replace district_name = "Hitchin and Harpenden" if district_code == 10749 & election == "2015 British general election"
replace district_name = "Holborn and St Pancras" if district_code == 10750 & election == "2015 British general election"
replace district_name = "Hornchurch and Upminster" if district_code == 10751 & election == "2015 British general election"
replace district_name = "Hornsey and Wood Green" if district_code == 10752 & election == "2015 British general election"
replace district_name = "Horsham" if district_code == 10753 & election == "2015 British general election"
replace district_name = "Houghton and Sunderland South" if district_code == 10754 & election == "2015 British general election"
replace district_name = "Hove" if district_code == 10755 & election == "2015 British general election"
replace district_name = "Huddersfield" if district_code == 10756 & election == "2015 British general election"
replace district_name = "Huntingdon" if district_code == 10757 & election == "2015 British general election"
replace district_name = "Hyndburn" if district_code == 10758 & election == "2015 British general election"
replace district_name = "Ilford North" if district_code == 10759 & election == "2015 British general election"
replace district_name = "Ilford South" if district_code == 10760 & election == "2015 British general election"
replace district_name = "Ipswich" if district_code == 10761 & election == "2015 British general election"
replace district_name = "Isle Of Wight" if district_code == 10762 & election == "2015 British general election"
replace district_name = "Islington North" if district_code == 10763 & election == "2015 British general election"
replace district_name = "Islington South and Finsbury" if district_code == 10764 & election == "2015 British general election"
replace district_name = "Jarrow" if district_code == 10765 & election == "2015 British general election"
replace district_name = "Keighley" if district_code == 10766 & election == "2015 British general election"
replace district_name = "Kenilworth and Southam" if district_code == 10767 & election == "2015 British general election"
replace district_name = "Kensington" if district_code == 10768 & election == "2015 British general election"
replace district_name = "Kettering" if district_code == 10769 & election == "2015 British general election"
replace district_name = "Kingston and Surbiton" if district_code == 10770 & election == "2015 British general election"
replace district_name = "Kingston upon Hull East" if district_code == 10771 & election == "2015 British general election"
replace district_name = "Kingston upon Hull North" if district_code == 10772 & election == "2015 British general election"
replace district_name = "Kingston upon Hull West and Hessle" if district_code == 10773 & election == "2015 British general election"
replace district_name = "Kingswood" if district_code == 10774 & election == "2015 British general election"
replace district_name = "Knowsley" if district_code == 10775 & election == "2015 British general election"
replace district_name = "Lancaster and Fleetwood" if district_code == 10776 & election == "2015 British general election"
replace district_name = "Leeds Central" if district_code == 10777 & election == "2015 British general election"
replace district_name = "Leeds East" if district_code == 10778 & election == "2015 British general election"
replace district_name = "Leeds North East" if district_code == 10779 & election == "2015 British general election"
replace district_name = "Leeds North West" if district_code == 10780 & election == "2015 British general election"
replace district_name = "Leeds West" if district_code == 10781 & election == "2015 British general election"
replace district_name = "Leicester East" if district_code == 10782 & election == "2015 British general election"
replace district_name = "Leicester South" if district_code == 10783 & election == "2015 British general election"
replace district_name = "Leicester West" if district_code == 10784 & election == "2015 British general election"
replace district_name = "Leigh" if district_code == 10785 & election == "2015 British general election"
replace district_name = "Lewes" if district_code == 10786 & election == "2015 British general election"
replace district_name = "Lewisham East" if district_code == 10787 & election == "2015 British general election"
replace district_name = "Lewisham West and Penge" if district_code == 10788 & election == "2015 British general election"
replace district_name = "Leyton and Wanstead" if district_code == 10790 & election == "2015 British general election"
replace district_name = "Lichfield" if district_code == 10791 & election == "2015 British general election"
replace district_name = "Lincoln" if district_code == 10792 & election == "2015 British general election"
replace district_name = "Loughborough" if district_code == 10797 & election == "2015 British general election"
replace district_name = "Louth and Horncastle" if district_code == 10798 & election == "2015 British general election"
replace district_name = "Ludlow" if district_code == 10799 & election == "2015 British general election"
replace district_name = "Luton North" if district_code == 10800 & election == "2015 British general election"
replace district_name = "Luton South" if district_code == 10801 & election == "2015 British general election"
replace district_name = "Macclesfield" if district_code == 10802 & election == "2015 British general election"
replace district_name = "Maidenhead" if district_code == 10803 & election == "2015 British general election"
replace district_name = "Maidstone and The Weald" if district_code == 10804 & election == "2015 British general election"
replace district_name = "Makerfield" if district_code == 10805 & election == "2015 British general election"
replace district_name = "Maldon" if district_code == 10806 & election == "2015 British general election"
replace district_name = "Manchester Central" if district_code == 10807 & election == "2015 British general election"
replace district_name = "Mansfield" if district_code == 10810 & election == "2015 British general election"
replace district_name = "Meon Valley" if district_code == 10811 & election == "2015 British general election"
replace district_name = "Meriden" if district_code == 10812 & election == "2015 British general election"
replace district_name = "Mid Bedfordshire" if district_code == 10813 & election == "2015 British general election"
replace district_name = "Mid Derbyshire" if district_code == 10814 & election == "2015 British general election"
replace district_name = "Mid Dorset and North Poole" if district_code == 10815 & election == "2015 British general election"
replace district_name = "Mid Norfolk" if district_code == 10816 & election == "2015 British general election"
replace district_name = "Mid Sussex" if district_code == 10817 & election == "2015 British general election"
replace district_name = "Mid Worcestershire" if district_code == 10818 & election == "2015 British general election"
replace district_name = "Middlesbrough" if district_code == 10819 & election == "2015 British general election"
replace district_name = "Middlesbrough South and East Cleveland" if district_code == 10820 & election == "2015 British general election"
replace district_name = "Milton Keynes North" if district_code == 10821 & election == "2015 British general election"
replace district_name = "Milton Keynes South" if district_code == 10822 & election == "2015 British general election"
replace district_name = "Mitcham and Morden" if district_code == 10823 & election == "2015 British general election"
replace district_name = "Mole Valley" if district_code == 10824 & election == "2015 British general election"
replace district_name = "Morecambe and Lunesdale" if district_code == 10825 & election == "2015 British general election"
replace district_name = "Morley and Outwood" if district_code == 10826 & election == "2015 British general election"
replace district_name = "New Forest East" if district_code == 10827 & election == "2015 British general election"
replace district_name = "New Forest West" if district_code == 10828 & election == "2015 British general election"
replace district_name = "Newark" if district_code == 10829 & election == "2015 British general election"
replace district_name = "Newbury" if district_code == 10830 & election == "2015 British general election"
replace district_name = "Newcastle Upon Tyne Central" if district_code == 10831 & election == "2015 British general election"
replace district_name = "Newcastle Upon Tyne East" if district_code == 10832 & election == "2015 British general election"
replace district_name = "Newcastle Upon Tyne North" if district_code == 10833 & election == "2015 British general election"
replace district_name = "Newcastle-Under-Lyme" if district_code == 10834 & election == "2015 British general election"
replace district_name = "Newton Abbot" if district_code == 10835 & election == "2015 British general election"
replace district_name = "North Cornwall" if district_code == 10837 & election == "2015 British general election"
replace district_name = "North Devon" if district_code == 10838 & election == "2015 British general election"
replace district_name = "North Dorset" if district_code == 10839 & election == "2015 British general election"
replace district_name = "North Durham" if district_code == 10840 & election == "2015 British general election"
replace district_name = "North East Bedfordshire" if district_code == 10841 & election == "2015 British general election"
replace district_name = "North East Cambridgeshire" if district_code == 10842 & election == "2015 British general election"
replace district_name = "North East Derbyshire" if district_code == 10843 & election == "2015 British general election"
replace district_name = "North East Hampshire" if district_code == 10844 & election == "2015 British general election"
replace district_name = "North East Hertfordshire" if district_code == 10845 & election == "2015 British general election"
replace district_name = "North East Somerset" if district_code == 10846 & election == "2015 British general election"
replace district_name = "North Herefordshire" if district_code == 10847 & election == "2015 British general election"
replace district_name = "North Norfolk" if district_code == 10848 & election == "2015 British general election"
replace district_name = "North Shropshire" if district_code == 10849 & election == "2015 British general election"
replace district_name = "North Somerset" if district_code == 10850 & election == "2015 British general election"
replace district_name = "North Swindon" if district_code == 10851 & election == "2015 British general election"
replace district_name = "North Thanet" if district_code == 10852 & election == "2015 British general election"
replace district_name = "North Tyneside" if district_code == 10853 & election == "2015 British general election"
replace district_name = "North Warwickshire" if district_code == 10854 & election == "2015 British general election"
replace district_name = "North West Cambridgeshire" if district_code == 10855 & election == "2015 British general election"
replace district_name = "North West Durham" if district_code == 10856 & election == "2015 British general election"
replace district_name = "North West Hampshire" if district_code == 10857 & election == "2015 British general election"
replace district_name = "North West Leicestershire" if district_code == 10858 & election == "2015 British general election"
replace district_name = "North West Norfolk" if district_code == 10859 & election == "2015 British general election"
replace district_name = "North Wiltshire" if district_code == 10860 & election == "2015 British general election"
replace district_name = "Northampton North" if district_code == 10861 & election == "2015 British general election"
replace district_name = "Northampton South" if district_code == 10862 & election == "2015 British general election"
replace district_name = "Norwich North" if district_code == 10863 & election == "2015 British general election"
replace district_name = "Norwich South" if district_code == 10864 & election == "2015 British general election"
replace district_name = "Nottingham East" if district_code == 10865 & election == "2015 British general election"
replace district_name = "Nottingham North" if district_code == 10866 & election == "2015 British general election"
replace district_name = "Nottingham South" if district_code == 10867 & election == "2015 British general election"
replace district_name = "Nuneaton" if district_code == 10868 & election == "2015 British general election"
replace district_name = "Old Bexley and Sidcup" if district_code == 10869 & election == "2015 British general election"
replace district_name = "Oldham East and Saddleworth" if district_code == 10870 & election == "2015 British general election"
replace district_name = "Oldham West and Royton" if district_code == 10871 & election == "2015 British general election"
replace district_name = "Orpington" if district_code == 10872 & election == "2015 British general election"
replace district_name = "Oxford East" if district_code == 10873 & election == "2015 British general election"
replace district_name = "Oxford West and Abingdon" if district_code == 10874 & election == "2015 British general election"
replace district_name = "Pendle" if district_code == 10875 & election == "2015 British general election"
replace district_name = "Penistone and Stocksbridge" if district_code == 10876 & election == "2015 British general election"
replace district_name = "Penrith and The Border" if district_code == 10877 & election == "2015 British general election"
replace district_name = "Peterborough" if district_code == 10878 & election == "2015 British general election"
replace district_name = "Poole" if district_code == 10881 & election == "2015 British general election"
replace district_name = "Poplar and Limehouse" if district_code == 10882 & election == "2015 British general election"
replace district_name = "Portsmouth North" if district_code == 10883 & election == "2015 British general election"
replace district_name = "Portsmouth South" if district_code == 10884 & election == "2015 British general election"
replace district_name = "Preston" if district_code == 10885 & election == "2015 British general election"
replace district_name = "Pudsey" if district_code == 10886 & election == "2015 British general election"
replace district_name = "Putney" if district_code == 10887 & election == "2015 British general election"
replace district_name = "Rayleigh and Wickford" if district_code == 10888 & election == "2015 British general election"
replace district_name = "Reading East" if district_code == 10889 & election == "2015 British general election"
replace district_name = "Reading West" if district_code == 10890 & election == "2015 British general election"
replace district_name = "Redcar" if district_code == 10891 & election == "2015 British general election"
replace district_name = "Redditch" if district_code == 10892 & election == "2015 British general election"
replace district_name = "Reigate" if district_code == 10893 & election == "2015 British general election"
replace district_name = "Ribble Valley" if district_code == 10894 & election == "2015 British general election"
replace district_name = "Richmond (Yorks)" if district_code == 10895 & election == "2015 British general election"
replace district_name = "Richmond Park" if district_code == 10896 & election == "2015 British general election"
replace district_name = "Rochdale" if district_code == 10897 & election == "2015 British general election"
replace district_name = "Rochester and Strood" if district_code == 10898 & election == "2015 British general election"
replace district_name = "Rochford and Southend East" if district_code == 10899 & election == "2015 British general election"
replace district_name = "Romford" if district_code == 10900 & election == "2015 British general election"
replace district_name = "Romsey and Southampton North" if district_code == 10901 & election == "2015 British general election"
replace district_name = "Rossendale and Darwen" if district_code == 10902 & election == "2015 British general election"
replace district_name = "Rother Valley" if district_code == 10903 & election == "2015 British general election"
replace district_name = "Rotherham" if district_code == 10904 & election == "2015 British general election"
replace district_name = "Rugby" if district_code == 10905 & election == "2015 British general election"
replace district_name = "Runnymede and Weybridge" if district_code == 10907 & election == "2015 British general election"
replace district_name = "Rushcliffe" if district_code == 10908 & election == "2015 British general election"
replace district_name = "Rutland and Melton" if district_code == 10909 & election == "2015 British general election"
replace district_name = "Saffron Walden" if district_code == 10910 & election == "2015 British general election"
replace district_name = "Salford and Eccles" if district_code == 10911 & election == "2015 British general election"
replace district_name = "Salisbury" if district_code == 10912 & election == "2015 British general election"
replace district_name = "Scarborough and Whitby" if district_code == 10913 & election == "2015 British general election"
replace district_name = "Scunthorpe" if district_code == 10914 & election == "2015 British general election"
replace district_name = "Sedgefield" if district_code == 10915 & election == "2015 British general election"
replace district_name = "Sefton Central" if district_code == 10916 & election == "2015 British general election"
replace district_name = "Selby and Ainsty" if district_code == 10917 & election == "2015 British general election"
replace district_name = "Sevenoaks" if district_code == 10918 & election == "2015 British general election"
replace district_name = "Sheffield Central" if district_code == 10919 & election == "2015 British general election"
replace district_name = "Sheffield South East" if district_code == 10920 & election == "2015 British general election"
replace district_name = "Sherwood" if district_code == 10924 & election == "2015 British general election"
replace district_name = "Shipley" if district_code == 10925 & election == "2015 British general election"
replace district_name = "Shrewsbury and Atcham" if district_code == 10926 & election == "2015 British general election"
replace district_name = "Sittingbourne and Sheppey" if district_code == 10927 & election == "2015 British general election"
replace district_name = "Skipton and Ripon" if district_code == 10928 & election == "2015 British general election"
replace district_name = "Sleaford and North Hykeham" if district_code == 10929 & election == "2015 British general election"
replace district_name = "Slough" if district_code == 10930 & election == "2015 British general election"
replace district_name = "Solihull" if district_code == 10931 & election == "2015 British general election"
replace district_name = "Somerton and Frome" if district_code == 10932 & election == "2015 British general election"
replace district_name = "South Basildon and East Thurrock" if district_code == 10933 & election == "2015 British general election"
replace district_name = "South Cambridgeshire" if district_code == 10934 & election == "2015 British general election"
replace district_name = "South Derbyshire" if district_code == 10935 & election == "2015 British general election"
replace district_name = "South Dorset" if district_code == 10936 & election == "2015 British general election"
replace district_name = "South East Cambridgeshire" if district_code == 10937 & election == "2015 British general election"
replace district_name = "South East Cornwall" if district_code == 10938 & election == "2015 British general election"
replace district_name = "South Holland and The Deepings" if district_code == 10939 & election == "2015 British general election"
replace district_name = "South Leicestershire" if district_code == 10940 & election == "2015 British general election"
replace district_name = "South Norfolk" if district_code == 10941 & election == "2015 British general election"
replace district_name = "South Northamptonshire" if district_code == 10942 & election == "2015 British general election"
replace district_name = "South Ribble" if district_code == 10943 & election == "2015 British general election"
replace district_name = "South Shields" if district_code == 10944 & election == "2015 British general election"
replace district_name = "South Staffordshire" if district_code == 10945 & election == "2015 British general election"
replace district_name = "South Suffolk" if district_code == 10946 & election == "2015 British general election"
replace district_name = "South Swindon" if district_code == 10947 & election == "2015 British general election"
replace district_name = "South Thanet" if district_code == 10948 & election == "2015 British general election"
replace district_name = "South West Bedfordshire" if district_code == 10949 & election == "2015 British general election"
replace district_name = "South West Devon" if district_code == 10950 & election == "2015 British general election"
replace district_name = "South West Hertfordshire" if district_code == 10951 & election == "2015 British general election"
replace district_name = "South West Norfolk" if district_code == 10952 & election == "2015 British general election"
replace district_name = "South West Surrey" if district_code == 10953 & election == "2015 British general election"
replace district_name = "South West Wiltshire" if district_code == 10954 & election == "2015 British general election"
replace district_name = "Southampton, Test" if district_code == 10956 & election == "2015 British general election"
replace district_name = "Southend West" if district_code == 10957 & election == "2015 British general election"
replace district_name = "Southport" if district_code == 10958 & election == "2015 British general election"
replace district_name = "Spelthorne" if district_code == 10959 & election == "2015 British general election"
replace district_name = "St Albans" if district_code == 10960 & election == "2015 British general election"
replace district_name = "St Austell and Newquay" if district_code == 10961 & election == "2015 British general election"
replace district_name = "St Helens North" if district_code == 10962 & election == "2015 British general election"
replace district_name = "St Helens South and Whiston" if district_code == 10963 & election == "2015 British general election"
replace district_name = "St Ives" if district_code == 10964 & election == "2015 British general election"
replace district_name = "Stafford" if district_code == 10965 & election == "2015 British general election"
replace district_name = "Staffordshire Moorlands" if district_code == 10966 & election == "2015 British general election"
replace district_name = "Stalybridge and Hyde" if district_code == 10967 & election == "2015 British general election"
replace district_name = "Stevenage" if district_code == 10968 & election == "2015 British general election"
replace district_name = "Stockport" if district_code == 10969 & election == "2015 British general election"
replace district_name = "Stockton North" if district_code == 10970 & election == "2015 British general election"
replace district_name = "Stockton South" if district_code == 10971 & election == "2015 British general election"
replace district_name = "Stoke-On-Trent Central" if district_code == 10972 & election == "2015 British general election"
replace district_name = "Stoke-On-Trent North" if district_code == 10973 & election == "2015 British general election"
replace district_name = "Stoke-On-Trent South" if district_code == 10974 & election == "2015 British general election"
replace district_name = "Stone" if district_code == 10975 & election == "2015 British general election"
replace district_name = "Stourbridge" if district_code == 10976 & election == "2015 British general election"
replace district_name = "Stratford-On-Avon" if district_code == 10977 & election == "2015 British general election"
replace district_name = "Streatham" if district_code == 10978 & election == "2015 British general election"
replace district_name = "Stretford and Urmston" if district_code == 10979 & election == "2015 British general election"
replace district_name = "Stroud" if district_code == 10980 & election == "2015 British general election"
replace district_name = "Suffolk Coastal" if district_code == 10981 & election == "2015 British general election"
replace district_name = "Sunderland Central" if district_code == 10982 & election == "2015 British general election"
replace district_name = "Surrey Heath" if district_code == 10983 & election == "2015 British general election"
replace district_name = "Sutton and Cheam" if district_code == 10984 & election == "2015 British general election"
replace district_name = "Sutton Coldfield" if district_code == 10985 & election == "2015 British general election"
replace district_name = "Tamworth" if district_code == 10986 & election == "2015 British general election"
replace district_name = "Tatton" if district_code == 10987 & election == "2015 British general election"
replace district_name = "Taunton Deane" if district_code == 10988 & election == "2015 British general election"
replace district_name = "Telford" if district_code == 10989 & election == "2015 British general election"
replace district_name = "Tewkesbury" if district_code == 10990 & election == "2015 British general election"
replace district_name = "The Cotswolds" if district_code == 10991 & election == "2015 British general election"
replace district_name = "The Wrekin" if district_code == 10992 & election == "2015 British general election"
replace district_name = "Thirsk and Malton" if district_code == 10993 & election == "2015 British general election"
replace district_name = "Thornbury and Yate" if district_code == 10994 & election == "2015 British general election"
replace district_name = "Thurrock" if district_code == 10995 & election == "2015 British general election"
replace district_name = "Tiverton and Honiton" if district_code == 10996 & election == "2015 British general election"
replace district_name = "Tonbridge and Malling" if district_code == 10997 & election == "2015 British general election"
replace district_name = "Tooting" if district_code == 10998 & election == "2015 British general election"
replace district_name = "Torbay" if district_code == 10999 & election == "2015 British general election"
replace district_name = "Torridge and West Devon" if district_code == 11000 & election == "2015 British general election"
replace district_name = "Totnes" if district_code == 11001 & election == "2015 British general election"
replace district_name = "Tottenham" if district_code == 11002 & election == "2015 British general election"
replace district_name = "Truro and Falmouth" if district_code == 11003 & election == "2015 British general election"
replace district_name = "Tunbridge Wells" if district_code == 11004 & election == "2015 British general election"
replace district_name = "Twickenham" if district_code == 11005 & election == "2015 British general election"
replace district_name = "Tynemouth" if district_code == 11006 & election == "2015 British general election"
replace district_name = "Uxbridge and South Ruislip" if district_code == 11007 & election == "2015 British general election"
replace district_name = "Vauxhall" if district_code == 11008 & election == "2015 British general election"
replace district_name = "Wakefield" if district_code == 11009 & election == "2015 British general election"
replace district_name = "Wallasey" if district_code == 11010 & election == "2015 British general election"
replace district_name = "Walsall North" if district_code == 11011 & election == "2015 British general election"
replace district_name = "Walsall South" if district_code == 11012 & election == "2015 British general election"
replace district_name = "Walthamstow" if district_code == 11013 & election == "2015 British general election"
replace district_name = "Wansbeck" if district_code == 11014 & election == "2015 British general election"
replace district_name = "Wantage" if district_code == 11015 & election == "2015 British general election"
replace district_name = "Warley" if district_code == 11016 & election == "2015 British general election"
replace district_name = "Warrington North" if district_code == 11017 & election == "2015 British general election"
replace district_name = "Warrington South" if district_code == 11018 & election == "2015 British general election"
replace district_name = "Warwick and Leamington" if district_code == 11019 & election == "2015 British general election"
replace district_name = "Washington and Sunderland West" if district_code == 11020 & election == "2015 British general election"
replace district_name = "Watford" if district_code == 11021 & election == "2015 British general election"
replace district_name = "Waveney" if district_code == 11022 & election == "2015 British general election"
replace district_name = "Wealden" if district_code == 11023 & election == "2015 British general election"
replace district_name = "Weaver Vale" if district_code == 11024 & election == "2015 British general election"
replace district_name = "Wellingborough" if district_code == 11025 & election == "2015 British general election"
replace district_name = "Wells" if district_code == 11026 & election == "2015 British general election"
replace district_name = "Welwyn Hatfield" if district_code == 11027 & election == "2015 British general election"
replace district_name = "Wentworth and Dearne" if district_code == 11028 & election == "2015 British general election"
replace district_name = "West Bromwich East" if district_code == 11029 & election == "2015 British general election"
replace district_name = "West Bromwich West" if district_code == 11030 & election == "2015 British general election"
replace district_name = "West Dorset" if district_code == 11031 & election == "2015 British general election"
replace district_name = "West Ham" if district_code == 11032 & election == "2015 British general election"
replace district_name = "West Lancashire" if district_code == 11033 & election == "2015 British general election"
replace district_name = "West Suffolk" if district_code == 11034 & election == "2015 British general election"
replace district_name = "West Worcestershire" if district_code == 11035 & election == "2015 British general election"
replace district_name = "Westminster North" if district_code == 11036 & election == "2015 British general election"
replace district_name = "Westmorland and Lonsdale" if district_code == 11037 & election == "2015 British general election"
replace district_name = "Weston-Super-Mare" if district_code == 11038 & election == "2015 British general election"
replace district_name = "Wigan" if district_code == 11039 & election == "2015 British general election"
replace district_name = "Wimbledon" if district_code == 11040 & election == "2015 British general election"
replace district_name = "Winchester" if district_code == 11041 & election == "2015 British general election"
replace district_name = "Windsor" if district_code == 11042 & election == "2015 British general election"
replace district_name = "Wirral South" if district_code == 11043 & election == "2015 British general election"
replace district_name = "Wirral West" if district_code == 11044 & election == "2015 British general election"
replace district_name = "Witham" if district_code == 11045 & election == "2015 British general election"
replace district_name = "Witney" if district_code == 11046 & election == "2015 British general election"
replace district_name = "Woking" if district_code == 11047 & election == "2015 British general election"
replace district_name = "Wokingham" if district_code == 11048 & election == "2015 British general election"
replace district_name = "Wolverhampton North East" if district_code == 11049 & election == "2015 British general election"
replace district_name = "Wolverhampton South East" if district_code == 11050 & election == "2015 British general election"
replace district_name = "Wolverhampton South West" if district_code == 11051 & election == "2015 British general election"
replace district_name = "Worcester" if district_code == 11052 & election == "2015 British general election"
replace district_name = "Workington" if district_code == 11053 & election == "2015 British general election"
replace district_name = "Worsley and Eccles South" if district_code == 11054 & election == "2015 British general election"
replace district_name = "Worthing West" if district_code == 11055 & election == "2015 British general election"
replace district_name = "Wycombe" if district_code == 11056 & election == "2015 British general election"
replace district_name = "Wyre and Preston North" if district_code == 11057 & election == "2015 British general election"
replace district_name = "Wyre Forest" if district_code == 11058 & election == "2015 British general election"
replace district_name = "Wythenshawe and Sale East" if district_code == 11059 & election == "2015 British general election"
replace district_name = "Yeovil" if district_code == 11060 & election == "2015 British general election"
replace district_name = "York Central" if district_code == 11061 & election == "2015 British general election"
replace district_name = "York Outer" if district_code == 11062 & election == "2015 British general election"
replace district_name = "Belfast East" if district_code == 40001 & election == "2015 British general election"
replace district_name = "Belfast North" if district_code == 40002 & election == "2015 British general election"
replace district_name = "Belfast South" if district_code == 40003 & election == "2015 British general election"
replace district_name = "Belfast West" if district_code == 40004 & election == "2015 British general election"
replace district_name = "East Antrim" if district_code == 40005 & election == "2015 British general election"
replace district_name = "East Londonderry" if district_code == 40006 & election == "2015 British general election"
replace district_name = "Fermanagh and South Tyrone" if district_code == 40007 & election == "2015 British general election"
replace district_name = "Foyle" if district_code == 40008 & election == "2015 British general election"
replace district_name = "Lagan Valley" if district_code == 40009 & election == "2015 British general election"
replace district_name = "Mid Ulster" if district_code == 40010 & election == "2015 British general election"
replace district_name = "Newry and Armagh" if district_code == 40011 & election == "2015 British general election"
replace district_name = "North Antrim" if district_code == 40012 & election == "2015 British general election"
replace district_name = "North Down" if district_code == 40013 & election == "2015 British general election"
replace district_name = "South Antrim" if district_code == 40014 & election == "2015 British general election"
replace district_name = "South Down" if district_code == 40015 & election == "2015 British general election"
replace district_name = "Strangford" if district_code == 40016 & election == "2015 British general election"
replace district_name = "Upper Bann" if district_code == 40017 & election == "2015 British general election"
replace district_name = "West Tyrone" if district_code == 40018 & election == "2015 British general election"
replace district_name = "Aberdeen North" if district_code == 20001 & election == "2015 British general election"
replace district_name = "Aberdeen South" if district_code == 20002 & election == "2015 British general election"
replace district_name = "Airdrie and Shotts" if district_code == 20003 & election == "2015 British general election"
replace district_name = "Angus" if district_code == 20004 & election == "2015 British general election"
replace district_name = "Argyll and Bute" if district_code == 20005 & election == "2015 British general election"
replace district_name = "Banff and Buchan" if district_code == 20007 & election == "2015 British general election"
replace district_name = "Central Ayrshire" if district_code == 20010 & election == "2015 British general election"
replace district_name = "Dumfries and Galloway" if district_code == 20013 & election == "2015 British general election"
replace district_name = "Dundee East" if district_code == 20015 & election == "2015 British general election"
replace district_name = "Dundee West" if district_code == 20016 & election == "2015 British general election"
replace district_name = "Dunfermline and West Fife" if district_code == 20017 & election == "2015 British general election"
replace district_name = "East Dunbartonshire" if district_code == 20018 & election == "2015 British general election"
replace district_name = "East Lothian" if district_code == 20020 & election == "2015 British general election"
replace district_name = "East Renfrewshire" if district_code == 20021 & election == "2015 British general election"
replace district_name = "Edinburgh East" if district_code == 20022 & election == "2015 British general election"
replace district_name = "Edinburgh North and Leith" if district_code == 20023 & election == "2015 British general election"
replace district_name = "Edinburgh South" if district_code == 20024 & election == "2015 British general election"
replace district_name = "Edinburgh South West" if district_code == 20025 & election == "2015 British general election"
replace district_name = "Edinburgh West" if district_code == 20026 & election == "2015 British general election"
replace district_name = "Na h-Eileanan An Iar" if district_code == 20027 & election == "2015 British general election"
replace district_name = "Falkirk" if district_code == 20028 & election == "2015 British general election"
replace district_name = "Glasgow Central" if district_code == 20029 & election == "2015 British general election"
replace district_name = "Glasgow East" if district_code == 20030 & election == "2015 British general election"
replace district_name = "Glasgow North" if district_code == 20031 & election == "2015 British general election"
replace district_name = "Glasgow North East" if district_code == 20032 & election == "2015 British general election"
replace district_name = "Glasgow North West" if district_code == 20033 & election == "2015 British general election"
replace district_name = "Glasgow South" if district_code == 20034 & election == "2015 British general election"
replace district_name = "Glasgow South West" if district_code == 20035 & election == "2015 British general election"
replace district_name = "Glenrothes" if district_code == 20036 & election == "2015 British general election"
replace district_name = "Gordon" if district_code == 20037 & election == "2015 British general election"
replace district_name = "Inverclyde" if district_code == 20038 & election == "2015 British general election"
replace district_name = "Kilmarnock and Loudoun" if district_code == 20040 & election == "2015 British general election"
replace district_name = "Kirkcaldy and Cowdenbeath" if district_code == 20041 & election == "2015 British general election"
replace district_name = "Lanark and Hamilton East" if district_code == 20042 & election == "2015 British general election"
replace district_name = "Linlithgow and East Falkirk" if district_code == 20043 & election == "2015 British general election"
replace district_name = "Livingston" if district_code == 20044 & election == "2015 British general election"
replace district_name = "Midlothian" if district_code == 20045 & election == "2015 British general election"
replace district_name = "Moray" if district_code == 20046 & election == "2015 British general election"
replace district_name = "Motherwell and Wishaw" if district_code == 20047 & election == "2015 British general election"
replace district_name = "North Ayrshire and Arran" if district_code == 20048 & election == "2015 British general election"
replace district_name = "North East Fife" if district_code == 20049 & election == "2015 British general election"
replace district_name = "Ochil and South Perthshire" if district_code == 20050 & election == "2015 British general election"
replace district_name = "Orkney and Shetland" if district_code == 20051 & election == "2015 British general election"
replace district_name = "Paisley and Renfrewshire North" if district_code == 20052 & election == "2015 British general election"
replace district_name = "Paisley and Renfrewshire South" if district_code == 20053 & election == "2015 British general election"
replace district_name = "Perth and North Perthshire" if district_code == 20054 & election == "2015 British general election"
replace district_name = "Ross, Skye and Lochaber" if district_code == 20055 & election == "2015 British general election"
replace district_name = "Rutherglen and Hamilton West" if district_code == 20056 & election == "2015 British general election"
replace district_name = "Stirling" if district_code == 20057 & election == "2015 British general election"
replace district_name = "West Aberdeenshire and Kincardine" if district_code == 20058 & election == "2015 British general election"
replace district_name = "West Dunbartonshire" if district_code == 20059 & election == "2015 British general election"
replace district_name = "Ynys Mon" if district_code == 30041 & election == "2015 British general election"
replace district_name = "Delyn" if district_code == 30042 & election == "2015 British general election"
replace district_name = "Alyn and Deeside" if district_code == 30043 & election == "2015 British general election"
replace district_name = "Wrexham" if district_code == 30044 & election == "2015 British general election"
replace district_name = "Llanelli" if district_code == 30045 & election == "2015 British general election"
replace district_name = "Gower" if district_code == 30046 & election == "2015 British general election"
replace district_name = "Swansea West" if district_code == 30047 & election == "2015 British general election"
replace district_name = "Swansea East" if district_code == 30048 & election == "2015 British general election"
replace district_name = "Aberavon" if district_code == 30049 & election == "2015 British general election"
replace district_name = "Cardiff Central" if district_code == 30050 & election == "2015 British general election"
replace district_name = "Cardiff North" if district_code == 30051 & election == "2015 British general election"
replace district_name = "Rhondda" if district_code == 30052 & election == "2015 British general election"
replace district_name = "Torfaen" if district_code == 30053 & election == "2015 British general election"
replace district_name = "Monmouth" if district_code == 30054 & election == "2015 British general election"
replace district_name = "Newport East" if district_code == 30055 & election == "2015 British general election"
replace district_name = "Newport West" if district_code == 30056 & election == "2015 British general election"
replace district_name = "Arfon" if district_code == 30057 & election == "2015 British general election"
replace district_name = "Aberconwy" if district_code == 30058 & election == "2015 British general election"
replace district_name = "Clwyd West" if district_code == 30059 & election == "2015 British general election"
replace district_name = "Vale Of Clwyd" if district_code == 30060 & election == "2015 British general election"
replace district_name = "Dwyfor Meirionnydd" if district_code == 30061 & election == "2015 British general election"
replace district_name = "Clwyd South" if district_code == 30062 & election == "2015 British general election"
replace district_name = "Montgomeryshire" if district_code == 30063 & election == "2015 British general election"
replace district_name = "Ceredigion" if district_code == 30064 & election == "2015 British general election"
replace district_name = "Preseli Pembrokeshire" if district_code == 30065 & election == "2015 British general election"
replace district_name = "Carmarthen West and South Pembrokeshire" if district_code == 30066 & election == "2015 British general election"
replace district_name = "Carmarthen East and Dinefwr" if district_code == 30067 & election == "2015 British general election"
replace district_name = "Brecon and Radnorshire" if district_code == 30068 & election == "2015 British general election"
replace district_name = "Neath" if district_code == 30069 & election == "2015 British general election"
replace district_name = "Cynon Valley" if district_code == 30070 & election == "2015 British general election"
replace district_name = "Merthyr Tydfil and Rhymney" if district_code == 30071 & election == "2015 British general election"
replace district_name = "Blaenau Gwent" if district_code == 30072 & election == "2015 British general election"
replace district_name = "Bridgend" if district_code == 30073 & election == "2015 British general election"
replace district_name = "Ogmore" if district_code == 30074 & election == "2015 British general election"
replace district_name = "Pontypridd" if district_code == 30075 & election == "2015 British general election"
replace district_name = "Caerphilly" if district_code == 30076 & election == "2015 British general election"
replace district_name = "Islwyn" if district_code == 30077 & election == "2015 British general election"
replace district_name = "Vale Of Glamorgan" if district_code == 30078 & election == "2015 British general election"
replace district_name = "Cardiff West" if district_code == 30079 & election == "2015 British general election"
replace district_name = "Cardiff South and Penarth" if district_code == 30080 & election == "2015 British general election"
replace district_name = "Aldershot" if district_code == 10530 & election == "2017 British general election"
replace district_name = "Aldridge-Brownhills" if district_code == 10531 & election == "2017 British general election"
replace district_name = "Altrincham and Sale West" if district_code == 10532 & election == "2017 British general election"
replace district_name = "Amber Valley" if district_code == 10533 & election == "2017 British general election"
replace district_name = "Arundel and South Downs" if district_code == 10534 & election == "2017 British general election"
replace district_name = "Ashfield" if district_code == 10535 & election == "2017 British general election"
replace district_name = "Ashford" if district_code == 10536 & election == "2017 British general election"
replace district_name = "Ashton-Under-Lyne" if district_code == 10537 & election == "2017 British general election"
replace district_name = "Aylesbury" if district_code == 10538 & election == "2017 British general election"
replace district_name = "Banbury" if district_code == 10539 & election == "2017 British general election"
replace district_name = "Barking" if district_code == 10540 & election == "2017 British general election"
replace district_name = "Barnsley Central" if district_code == 10541 & election == "2017 British general election"
replace district_name = "Barnsley East" if district_code == 10542 & election == "2017 British general election"
replace district_name = "Barrow and Furness" if district_code == 10543 & election == "2017 British general election"
replace district_name = "Basildon and Billericay" if district_code == 10544 & election == "2017 British general election"
replace district_name = "Basingstoke" if district_code == 10545 & election == "2017 British general election"
replace district_name = "Bassetlaw" if district_code == 10546 & election == "2017 British general election"
replace district_name = "Bath" if district_code == 10547 & election == "2017 British general election"
replace district_name = "Batley and Spen" if district_code == 10548 & election == "2017 British general election"
replace district_name = "Battersea" if district_code == 10549 & election == "2017 British general election"
replace district_name = "Beaconsfield" if district_code == 10550 & election == "2017 British general election"
replace district_name = "Beckenham" if district_code == 10551 & election == "2017 British general election"
replace district_name = "Bedford" if district_code == 10552 & election == "2017 British general election"
replace district_name = "Bermondsey and Old Southwark" if district_code == 10553 & election == "2017 British general election"
replace district_name = "Berwick-Upon-Tweed" if district_code == 10554 & election == "2017 British general election"
replace district_name = "Bethnal Green and Bow" if district_code == 10555 & election == "2017 British general election"
replace district_name = "Beverley and Holderness" if district_code == 10556 & election == "2017 British general election"
replace district_name = "Bexhill and Battle" if district_code == 10557 & election == "2017 British general election"
replace district_name = "Bexleyheath and Crayford" if district_code == 10558 & election == "2017 British general election"
replace district_name = "Birkenhead" if district_code == 10559 & election == "2017 British general election"
replace district_name = "Birmingham, Yardley" if district_code == 10568 & election == "2017 British general election"
replace district_name = "Bishop Auckland" if district_code == 10569 & election == "2017 British general election"
replace district_name = "Blackburn" if district_code == 10570 & election == "2017 British general election"
replace district_name = "Blackley and Broughton" if district_code == 10571 & election == "2017 British general election"
replace district_name = "Blackpool North and Cleveleys" if district_code == 10572 & election == "2017 British general election"
replace district_name = "Blackpool South" if district_code == 10573 & election == "2017 British general election"
replace district_name = "Blaydon" if district_code == 10574 & election == "2017 British general election"
replace district_name = "Blyth Valley" if district_code == 10575 & election == "2017 British general election"
replace district_name = "Bognor Regis and Littlehampton" if district_code == 10576 & election == "2017 British general election"
replace district_name = "Bolsover" if district_code == 10577 & election == "2017 British general election"
replace district_name = "Bolton North East" if district_code == 10578 & election == "2017 British general election"
replace district_name = "Bolton South East" if district_code == 10579 & election == "2017 British general election"
replace district_name = "Bolton West" if district_code == 10580 & election == "2017 British general election"
replace district_name = "Bootle" if district_code == 10581 & election == "2017 British general election"
replace district_name = "Boston and Skegness" if district_code == 10582 & election == "2017 British general election"
replace district_name = "Bosworth" if district_code == 10583 & election == "2017 British general election"
replace district_name = "Bournemouth East" if district_code == 10584 & election == "2017 British general election"
replace district_name = "Bournemouth West" if district_code == 10585 & election == "2017 British general election"
replace district_name = "Bracknell" if district_code == 10586 & election == "2017 British general election"
replace district_name = "Bradford East" if district_code == 10587 & election == "2017 British general election"
replace district_name = "Bradford South" if district_code == 10588 & election == "2017 British general election"
replace district_name = "Bradford West" if district_code == 10589 & election == "2017 British general election"
replace district_name = "Braintree" if district_code == 10590 & election == "2017 British general election"
replace district_name = "Brent Central" if district_code == 10591 & election == "2017 British general election"
replace district_name = "Brent North" if district_code == 10592 & election == "2017 British general election"
replace district_name = "Brentford and Isleworth" if district_code == 10593 & election == "2017 British general election"
replace district_name = "Brentwood and Ongar" if district_code == 10594 & election == "2017 British general election"
replace district_name = "Bridgwater and West Somerset" if district_code == 10595 & election == "2017 British general election"
replace district_name = "Brigg and Goole" if district_code == 10596 & election == "2017 British general election"
replace district_name = "Brighton, Pavilion" if district_code == 10598 & election == "2017 British general election"
replace district_name = "Bristol East" if district_code == 10599 & election == "2017 British general election"
replace district_name = "Bristol North West" if district_code == 10600 & election == "2017 British general election"
replace district_name = "Bristol South" if district_code == 10601 & election == "2017 British general election"
replace district_name = "Bristol West" if district_code == 10602 & election == "2017 British general election"
replace district_name = "Broadland" if district_code == 10603 & election == "2017 British general election"
replace district_name = "Bromley and Chislehurst" if district_code == 10604 & election == "2017 British general election"
replace district_name = "Bromsgrove" if district_code == 10605 & election == "2017 British general election"
replace district_name = "Broxbourne" if district_code == 10606 & election == "2017 British general election"
replace district_name = "Broxtowe" if district_code == 10607 & election == "2017 British general election"
replace district_name = "Buckingham" if district_code == 10608 & election == "2017 British general election"
replace district_name = "Burnley" if district_code == 10609 & election == "2017 British general election"
replace district_name = "Burton" if district_code == 10610 & election == "2017 British general election"
replace district_name = "Bury North" if district_code == 10611 & election == "2017 British general election"
replace district_name = "Bury South" if district_code == 10612 & election == "2017 British general election"
replace district_name = "Bury St Edmunds" if district_code == 10613 & election == "2017 British general election"
replace district_name = "Calder Valley" if district_code == 10614 & election == "2017 British general election"
replace district_name = "Camberwell and Peckham" if district_code == 10615 & election == "2017 British general election"
replace district_name = "Camborne and Redruth" if district_code == 10616 & election == "2017 British general election"
replace district_name = "Cambridge" if district_code == 10617 & election == "2017 British general election"
replace district_name = "Cannock Chase" if district_code == 10618 & election == "2017 British general election"
replace district_name = "Canterbury" if district_code == 10619 & election == "2017 British general election"
replace district_name = "Carlisle" if district_code == 10620 & election == "2017 British general election"
replace district_name = "Carshalton and Wallington" if district_code == 10621 & election == "2017 British general election"
replace district_name = "Castle Point" if district_code == 10622 & election == "2017 British general election"
replace district_name = "Central Devon" if district_code == 10623 & election == "2017 British general election"
replace district_name = "Central Suffolk and North Ipswich" if district_code == 10624 & election == "2017 British general election"
replace district_name = "Charnwood" if district_code == 10625 & election == "2017 British general election"
replace district_name = "Chatham and Aylesford" if district_code == 10626 & election == "2017 British general election"
replace district_name = "Cheadle" if district_code == 10627 & election == "2017 British general election"
replace district_name = "Chelmsford" if district_code == 10628 & election == "2017 British general election"
replace district_name = "Chelsea and Fulham" if district_code == 10629 & election == "2017 British general election"
replace district_name = "Cheltenham" if district_code == 10630 & election == "2017 British general election"
replace district_name = "Chesham and Amersham" if district_code == 10631 & election == "2017 British general election"
replace district_name = "Chesterfield" if district_code == 10632 & election == "2017 British general election"
replace district_name = "Chichester" if district_code == 10633 & election == "2017 British general election"
replace district_name = "Chingford and Woodford Green" if district_code == 10634 & election == "2017 British general election"
replace district_name = "Chippenham" if district_code == 10635 & election == "2017 British general election"
replace district_name = "Chipping Barnet" if district_code == 10636 & election == "2017 British general election"
replace district_name = "Chorley" if district_code == 10637 & election == "2017 British general election"
replace district_name = "Christchurch" if district_code == 10638 & election == "2017 British general election"
replace district_name = "Cities Of London and Westminster" if district_code == 10639 & election == "2017 British general election"
replace district_name = "City Of Chester" if district_code == 10640 & election == "2017 British general election"
replace district_name = "City Of Durham" if district_code == 10641 & election == "2017 British general election"
replace district_name = "Clacton" if district_code == 10642 & election == "2017 British general election"
replace district_name = "Cleethorpes" if district_code == 10643 & election == "2017 British general election"
replace district_name = "Colchester" if district_code == 10644 & election == "2017 British general election"
replace district_name = "Colne Valley" if district_code == 10645 & election == "2017 British general election"
replace district_name = "Congleton" if district_code == 10646 & election == "2017 British general election"
replace district_name = "Copeland" if district_code == 10647 & election == "2017 British general election"
replace district_name = "Corby" if district_code == 10648 & election == "2017 British general election"
replace district_name = "Coventry North East" if district_code == 10649 & election == "2017 British general election"
replace district_name = "Coventry North West" if district_code == 10650 & election == "2017 British general election"
replace district_name = "Coventry South" if district_code == 10651 & election == "2017 British general election"
replace district_name = "Crawley" if district_code == 10652 & election == "2017 British general election"
replace district_name = "Crewe and Nantwich" if district_code == 10653 & election == "2017 British general election"
replace district_name = "Croydon Central" if district_code == 10654 & election == "2017 British general election"
replace district_name = "Croydon North" if district_code == 10655 & election == "2017 British general election"
replace district_name = "Croydon South" if district_code == 10656 & election == "2017 British general election"
replace district_name = "Dagenham and Rainham" if district_code == 10657 & election == "2017 British general election"
replace district_name = "Darlington" if district_code == 10658 & election == "2017 British general election"
replace district_name = "Dartford" if district_code == 10659 & election == "2017 British general election"
replace district_name = "Daventry" if district_code == 10660 & election == "2017 British general election"
replace district_name = "Denton and Reddish" if district_code == 10661 & election == "2017 British general election"
replace district_name = "Derby North" if district_code == 10662 & election == "2017 British general election"
replace district_name = "Derby South" if district_code == 10663 & election == "2017 British general election"
replace district_name = "Derbyshire Dales" if district_code == 10664 & election == "2017 British general election"
replace district_name = "Devizes" if district_code == 10665 & election == "2017 British general election"
replace district_name = "Dewsbury" if district_code == 10666 & election == "2017 British general election"
replace district_name = "Don Valley" if district_code == 10667 & election == "2017 British general election"
replace district_name = "Doncaster Central" if district_code == 10668 & election == "2017 British general election"
replace district_name = "Doncaster North" if district_code == 10669 & election == "2017 British general election"
replace district_name = "Dover" if district_code == 10670 & election == "2017 British general election"
replace district_name = "Dudley North" if district_code == 10671 & election == "2017 British general election"
replace district_name = "Dudley South" if district_code == 10672 & election == "2017 British general election"
replace district_name = "Dulwich and West Norwood" if district_code == 10673 & election == "2017 British general election"
replace district_name = "Ealing Central and Acton" if district_code == 10674 & election == "2017 British general election"
replace district_name = "Ealing North" if district_code == 10675 & election == "2017 British general election"
replace district_name = "Easington" if district_code == 10677 & election == "2017 British general election"
replace district_name = "East Devon" if district_code == 10678 & election == "2017 British general election"
replace district_name = "East Ham" if district_code == 10679 & election == "2017 British general election"
replace district_name = "East Hampshire" if district_code == 10680 & election == "2017 British general election"
replace district_name = "East Surrey" if district_code == 10681 & election == "2017 British general election"
replace district_name = "East Worthing and Shoreham" if district_code == 10682 & election == "2017 British general election"
replace district_name = "East Yorkshire" if district_code == 10683 & election == "2017 British general election"
replace district_name = "Eastbourne" if district_code == 10684 & election == "2017 British general election"
replace district_name = "Eastleigh" if district_code == 10685 & election == "2017 British general election"
replace district_name = "Eddisbury" if district_code == 10686 & election == "2017 British general election"
replace district_name = "Edmonton" if district_code == 10687 & election == "2017 British general election"
replace district_name = "Ellesmere Port and Neston" if district_code == 10688 & election == "2017 British general election"
replace district_name = "Elmet and Rothwell" if district_code == 10689 & election == "2017 British general election"
replace district_name = "Eltham" if district_code == 10690 & election == "2017 British general election"
replace district_name = "Enfield North" if district_code == 10691 & election == "2017 British general election"
replace district_name = "Epping Forest" if district_code == 10693 & election == "2017 British general election"
replace district_name = "Epsom and Ewell" if district_code == 10694 & election == "2017 British general election"
replace district_name = "Erewash" if district_code == 10695 & election == "2017 British general election"
replace district_name = "Erith and Thamesmead" if district_code == 10696 & election == "2017 British general election"
replace district_name = "Esher and Walton" if district_code == 10697 & election == "2017 British general election"
replace district_name = "Exeter" if district_code == 10698 & election == "2017 British general election"
replace district_name = "Fareham" if district_code == 10699 & election == "2017 British general election"
replace district_name = "Faversham and Mid Kent" if district_code == 10700 & election == "2017 British general election"
replace district_name = "Feltham and Heston" if district_code == 10701 & election == "2017 British general election"
replace district_name = "Filton and Bradley Stoke" if district_code == 10702 & election == "2017 British general election"
replace district_name = "Finchley and Golders Green" if district_code == 10703 & election == "2017 British general election"
replace district_name = "Folkestone and Hythe" if district_code == 10704 & election == "2017 British general election"
replace district_name = "Forest Of Dean" if district_code == 10705 & election == "2017 British general election"
replace district_name = "Fylde" if district_code == 10706 & election == "2017 British general election"
replace district_name = "Gainsborough" if district_code == 10707 & election == "2017 British general election"
replace district_name = "Garston and Halewood" if district_code == 10708 & election == "2017 British general election"
replace district_name = "Gateshead" if district_code == 10709 & election == "2017 British general election"
replace district_name = "Gedling" if district_code == 10710 & election == "2017 British general election"
replace district_name = "Gillingham and Rainham" if district_code == 10711 & election == "2017 British general election"
replace district_name = "Gloucester" if district_code == 10712 & election == "2017 British general election"
replace district_name = "Gosport" if district_code == 10713 & election == "2017 British general election"
replace district_name = "Grantham and Stamford" if district_code == 10714 & election == "2017 British general election"
replace district_name = "Gravesham" if district_code == 10715 & election == "2017 British general election"
replace district_name = "Great Grimsby" if district_code == 10716 & election == "2017 British general election"
replace district_name = "Great Yarmouth" if district_code == 10717 & election == "2017 British general election"
replace district_name = "Greenwich and Woolwich" if district_code == 10718 & election == "2017 British general election"
replace district_name = "Guildford" if district_code == 10719 & election == "2017 British general election"
replace district_name = "Hackney North and Stoke Newington" if district_code == 10720 & election == "2017 British general election"
replace district_name = "Hackney South and Shoreditch" if district_code == 10721 & election == "2017 British general election"
replace district_name = "Halesowen and Rowley Regis" if district_code == 10722 & election == "2017 British general election"
replace district_name = "Halifax" if district_code == 10723 & election == "2017 British general election"
replace district_name = "Haltemprice and Howden" if district_code == 10724 & election == "2017 British general election"
replace district_name = "Halton" if district_code == 10725 & election == "2017 British general election"
replace district_name = "Hammersmith" if district_code == 10726 & election == "2017 British general election"
replace district_name = "Hampstead and Kilburn" if district_code == 10727 & election == "2017 British general election"
replace district_name = "Harborough" if district_code == 10728 & election == "2017 British general election"
replace district_name = "Harlow" if district_code == 10729 & election == "2017 British general election"
replace district_name = "Harrogate and Knaresborough" if district_code == 10730 & election == "2017 British general election"
replace district_name = "Harrow East" if district_code == 10731 & election == "2017 British general election"
replace district_name = "Harrow West" if district_code == 10732 & election == "2017 British general election"
replace district_name = "Hartlepool" if district_code == 10733 & election == "2017 British general election"
replace district_name = "Harwich and North Essex" if district_code == 10734 & election == "2017 British general election"
replace district_name = "Hastings and Rye" if district_code == 10735 & election == "2017 British general election"
replace district_name = "Havant" if district_code == 10736 & election == "2017 British general election"
replace district_name = "Hayes and Harlington" if district_code == 10737 & election == "2017 British general election"
replace district_name = "Hazel Grove" if district_code == 10738 & election == "2017 British general election"
replace district_name = "Hemel Hempstead" if district_code == 10739 & election == "2017 British general election"
replace district_name = "Hemsworth" if district_code == 10740 & election == "2017 British general election"
replace district_name = "Hendon" if district_code == 10741 & election == "2017 British general election"
replace district_name = "Henley" if district_code == 10742 & election == "2017 British general election"
replace district_name = "Hereford and South Herefordshire" if district_code == 10743 & election == "2017 British general election"
replace district_name = "Hertford and Stortford" if district_code == 10744 & election == "2017 British general election"
replace district_name = "Hertsmere" if district_code == 10745 & election == "2017 British general election"
replace district_name = "Hexham" if district_code == 10746 & election == "2017 British general election"
replace district_name = "Heywood and Middleton" if district_code == 10747 & election == "2017 British general election"
replace district_name = "High Peak" if district_code == 10748 & election == "2017 British general election"
replace district_name = "Hitchin and Harpenden" if district_code == 10749 & election == "2017 British general election"
replace district_name = "Holborn and St Pancras" if district_code == 10750 & election == "2017 British general election"
replace district_name = "Hornchurch and Upminster" if district_code == 10751 & election == "2017 British general election"
replace district_name = "Hornsey and Wood Green" if district_code == 10752 & election == "2017 British general election"
replace district_name = "Horsham" if district_code == 10753 & election == "2017 British general election"
replace district_name = "Houghton and Sunderland South" if district_code == 10754 & election == "2017 British general election"
replace district_name = "Hove" if district_code == 10755 & election == "2017 British general election"
replace district_name = "Huddersfield" if district_code == 10756 & election == "2017 British general election"
replace district_name = "Huntingdon" if district_code == 10757 & election == "2017 British general election"
replace district_name = "Hyndburn" if district_code == 10758 & election == "2017 British general election"
replace district_name = "Ilford North" if district_code == 10759 & election == "2017 British general election"
replace district_name = "Ilford South" if district_code == 10760 & election == "2017 British general election"
replace district_name = "Ipswich" if district_code == 10761 & election == "2017 British general election"
replace district_name = "Isle Of Wight" if district_code == 10762 & election == "2017 British general election"
replace district_name = "Islington North" if district_code == 10763 & election == "2017 British general election"
replace district_name = "Islington South and Finsbury" if district_code == 10764 & election == "2017 British general election"
replace district_name = "Jarrow" if district_code == 10765 & election == "2017 British general election"
replace district_name = "Keighley" if district_code == 10766 & election == "2017 British general election"
replace district_name = "Kenilworth and Southam" if district_code == 10767 & election == "2017 British general election"
replace district_name = "Kensington" if district_code == 10768 & election == "2017 British general election"
replace district_name = "Kettering" if district_code == 10769 & election == "2017 British general election"
replace district_name = "Kingston and Surbiton" if district_code == 10770 & election == "2017 British general election"
replace district_name = "Kingston upon Hull East" if district_code == 10771 & election == "2017 British general election"
replace district_name = "Kingston upon Hull North" if district_code == 10772 & election == "2017 British general election"
replace district_name = "Kingston upon Hull West and Hessle" if district_code == 10773 & election == "2017 British general election"
replace district_name = "Kingswood" if district_code == 10774 & election == "2017 British general election"
replace district_name = "Knowsley" if district_code == 10775 & election == "2017 British general election"
replace district_name = "Lancaster and Fleetwood" if district_code == 10776 & election == "2017 British general election"
replace district_name = "Leeds Central" if district_code == 10777 & election == "2017 British general election"
replace district_name = "Leeds East" if district_code == 10778 & election == "2017 British general election"
replace district_name = "Leeds North East" if district_code == 10779 & election == "2017 British general election"
replace district_name = "Leeds North West" if district_code == 10780 & election == "2017 British general election"
replace district_name = "Leeds West" if district_code == 10781 & election == "2017 British general election"
replace district_name = "Leicester East" if district_code == 10782 & election == "2017 British general election"
replace district_name = "Leicester South" if district_code == 10783 & election == "2017 British general election"
replace district_name = "Leicester West" if district_code == 10784 & election == "2017 British general election"
replace district_name = "Leigh" if district_code == 10785 & election == "2017 British general election"
replace district_name = "Lewes" if district_code == 10786 & election == "2017 British general election"
replace district_name = "Lewisham East" if district_code == 10787 & election == "2017 British general election"
replace district_name = "Lewisham West and Penge" if district_code == 10788 & election == "2017 British general election"
replace district_name = "Leyton and Wanstead" if district_code == 10790 & election == "2017 British general election"
replace district_name = "Lichfield" if district_code == 10791 & election == "2017 British general election"
replace district_name = "Lincoln" if district_code == 10792 & election == "2017 British general election"
replace district_name = "Loughborough" if district_code == 10797 & election == "2017 British general election"
replace district_name = "Louth and Horncastle" if district_code == 10798 & election == "2017 British general election"
replace district_name = "Ludlow" if district_code == 10799 & election == "2017 British general election"
replace district_name = "Luton North" if district_code == 10800 & election == "2017 British general election"
replace district_name = "Luton South" if district_code == 10801 & election == "2017 British general election"
replace district_name = "Macclesfield" if district_code == 10802 & election == "2017 British general election"
replace district_name = "Maidenhead" if district_code == 10803 & election == "2017 British general election"
replace district_name = "Maidstone and The Weald" if district_code == 10804 & election == "2017 British general election"
replace district_name = "Makerfield" if district_code == 10805 & election == "2017 British general election"
replace district_name = "Maldon" if district_code == 10806 & election == "2017 British general election"
replace district_name = "Manchester Central" if district_code == 10807 & election == "2017 British general election"
replace district_name = "Mansfield" if district_code == 10810 & election == "2017 British general election"
replace district_name = "Meon Valley" if district_code == 10811 & election == "2017 British general election"
replace district_name = "Meriden" if district_code == 10812 & election == "2017 British general election"
replace district_name = "Mid Bedfordshire" if district_code == 10813 & election == "2017 British general election"
replace district_name = "Mid Derbyshire" if district_code == 10814 & election == "2017 British general election"
replace district_name = "Mid Dorset and North Poole" if district_code == 10815 & election == "2017 British general election"
replace district_name = "Mid Norfolk" if district_code == 10816 & election == "2017 British general election"
replace district_name = "Mid Sussex" if district_code == 10817 & election == "2017 British general election"
replace district_name = "Mid Worcestershire" if district_code == 10818 & election == "2017 British general election"
replace district_name = "Middlesbrough" if district_code == 10819 & election == "2017 British general election"
replace district_name = "Middlesbrough South and East Cleveland" if district_code == 10820 & election == "2017 British general election"
replace district_name = "Milton Keynes North" if district_code == 10821 & election == "2017 British general election"
replace district_name = "Milton Keynes South" if district_code == 10822 & election == "2017 British general election"
replace district_name = "Mitcham and Morden" if district_code == 10823 & election == "2017 British general election"
replace district_name = "Mole Valley" if district_code == 10824 & election == "2017 British general election"
replace district_name = "Morecambe and Lunesdale" if district_code == 10825 & election == "2017 British general election"
replace district_name = "Morley and Outwood" if district_code == 10826 & election == "2017 British general election"
replace district_name = "New Forest East" if district_code == 10827 & election == "2017 British general election"
replace district_name = "New Forest West" if district_code == 10828 & election == "2017 British general election"
replace district_name = "Newark" if district_code == 10829 & election == "2017 British general election"
replace district_name = "Newbury" if district_code == 10830 & election == "2017 British general election"
replace district_name = "Newcastle Upon Tyne Central" if district_code == 10831 & election == "2017 British general election"
replace district_name = "Newcastle Upon Tyne East" if district_code == 10832 & election == "2017 British general election"
replace district_name = "Newcastle Upon Tyne North" if district_code == 10833 & election == "2017 British general election"
replace district_name = "Newcastle-Under-Lyme" if district_code == 10834 & election == "2017 British general election"
replace district_name = "Newton Abbot" if district_code == 10835 & election == "2017 British general election"
replace district_name = "North Cornwall" if district_code == 10837 & election == "2017 British general election"
replace district_name = "North Devon" if district_code == 10838 & election == "2017 British general election"
replace district_name = "North Dorset" if district_code == 10839 & election == "2017 British general election"
replace district_name = "North Durham" if district_code == 10840 & election == "2017 British general election"
replace district_name = "North East Bedfordshire" if district_code == 10841 & election == "2017 British general election"
replace district_name = "North East Cambridgeshire" if district_code == 10842 & election == "2017 British general election"
replace district_name = "North East Derbyshire" if district_code == 10843 & election == "2017 British general election"
replace district_name = "North East Hampshire" if district_code == 10844 & election == "2017 British general election"
replace district_name = "North East Hertfordshire" if district_code == 10845 & election == "2017 British general election"
replace district_name = "North East Somerset" if district_code == 10846 & election == "2017 British general election"
replace district_name = "North Herefordshire" if district_code == 10847 & election == "2017 British general election"
replace district_name = "North Norfolk" if district_code == 10848 & election == "2017 British general election"
replace district_name = "North Shropshire" if district_code == 10849 & election == "2017 British general election"
replace district_name = "North Somerset" if district_code == 10850 & election == "2017 British general election"
replace district_name = "North Swindon" if district_code == 10851 & election == "2017 British general election"
replace district_name = "North Thanet" if district_code == 10852 & election == "2017 British general election"
replace district_name = "North Tyneside" if district_code == 10853 & election == "2017 British general election"
replace district_name = "North Warwickshire" if district_code == 10854 & election == "2017 British general election"
replace district_name = "North West Cambridgeshire" if district_code == 10855 & election == "2017 British general election"
replace district_name = "North West Durham" if district_code == 10856 & election == "2017 British general election"
replace district_name = "North West Hampshire" if district_code == 10857 & election == "2017 British general election"
replace district_name = "North West Leicestershire" if district_code == 10858 & election == "2017 British general election"
replace district_name = "North West Norfolk" if district_code == 10859 & election == "2017 British general election"
replace district_name = "North Wiltshire" if district_code == 10860 & election == "2017 British general election"
replace district_name = "Northampton North" if district_code == 10861 & election == "2017 British general election"
replace district_name = "Northampton South" if district_code == 10862 & election == "2017 British general election"
replace district_name = "Norwich North" if district_code == 10863 & election == "2017 British general election"
replace district_name = "Norwich South" if district_code == 10864 & election == "2017 British general election"
replace district_name = "Nottingham East" if district_code == 10865 & election == "2017 British general election"
replace district_name = "Nottingham North" if district_code == 10866 & election == "2017 British general election"
replace district_name = "Nottingham South" if district_code == 10867 & election == "2017 British general election"
replace district_name = "Nuneaton" if district_code == 10868 & election == "2017 British general election"
replace district_name = "Old Bexley and Sidcup" if district_code == 10869 & election == "2017 British general election"
replace district_name = "Oldham East and Saddleworth" if district_code == 10870 & election == "2017 British general election"
replace district_name = "Oldham West and Royton" if district_code == 10871 & election == "2017 British general election"
replace district_name = "Orpington" if district_code == 10872 & election == "2017 British general election"
replace district_name = "Oxford East" if district_code == 10873 & election == "2017 British general election"
replace district_name = "Oxford West and Abingdon" if district_code == 10874 & election == "2017 British general election"
replace district_name = "Pendle" if district_code == 10875 & election == "2017 British general election"
replace district_name = "Penistone and Stocksbridge" if district_code == 10876 & election == "2017 British general election"
replace district_name = "Penrith and The Border" if district_code == 10877 & election == "2017 British general election"
replace district_name = "Peterborough" if district_code == 10878 & election == "2017 British general election"
replace district_name = "Poole" if district_code == 10881 & election == "2017 British general election"
replace district_name = "Poplar and Limehouse" if district_code == 10882 & election == "2017 British general election"
replace district_name = "Portsmouth North" if district_code == 10883 & election == "2017 British general election"
replace district_name = "Portsmouth South" if district_code == 10884 & election == "2017 British general election"
replace district_name = "Preston" if district_code == 10885 & election == "2017 British general election"
replace district_name = "Pudsey" if district_code == 10886 & election == "2017 British general election"
replace district_name = "Putney" if district_code == 10887 & election == "2017 British general election"
replace district_name = "Rayleigh and Wickford" if district_code == 10888 & election == "2017 British general election"
replace district_name = "Reading East" if district_code == 10889 & election == "2017 British general election"
replace district_name = "Reading West" if district_code == 10890 & election == "2017 British general election"
replace district_name = "Redcar" if district_code == 10891 & election == "2017 British general election"
replace district_name = "Redditch" if district_code == 10892 & election == "2017 British general election"
replace district_name = "Reigate" if district_code == 10893 & election == "2017 British general election"
replace district_name = "Ribble Valley" if district_code == 10894 & election == "2017 British general election"
replace district_name = "Richmond (Yorks)" if district_code == 10895 & election == "2017 British general election"
replace district_name = "Richmond Park" if district_code == 10896 & election == "2017 British general election"
replace district_name = "Rochdale" if district_code == 10897 & election == "2017 British general election"
replace district_name = "Rochester and Strood" if district_code == 10898 & election == "2017 British general election"
replace district_name = "Rochford and Southend East" if district_code == 10899 & election == "2017 British general election"
replace district_name = "Romford" if district_code == 10900 & election == "2017 British general election"
replace district_name = "Romsey and Southampton North" if district_code == 10901 & election == "2017 British general election"
replace district_name = "Rossendale and Darwen" if district_code == 10902 & election == "2017 British general election"
replace district_name = "Rother Valley" if district_code == 10903 & election == "2017 British general election"
replace district_name = "Rotherham" if district_code == 10904 & election == "2017 British general election"
replace district_name = "Rugby" if district_code == 10905 & election == "2017 British general election"
replace district_name = "Runnymede and Weybridge" if district_code == 10907 & election == "2017 British general election"
replace district_name = "Rushcliffe" if district_code == 10908 & election == "2017 British general election"
replace district_name = "Rutland and Melton" if district_code == 10909 & election == "2017 British general election"
replace district_name = "Saffron Walden" if district_code == 10910 & election == "2017 British general election"
replace district_name = "Salford and Eccles" if district_code == 10911 & election == "2017 British general election"
replace district_name = "Salisbury" if district_code == 10912 & election == "2017 British general election"
replace district_name = "Scarborough and Whitby" if district_code == 10913 & election == "2017 British general election"
replace district_name = "Scunthorpe" if district_code == 10914 & election == "2017 British general election"
replace district_name = "Sedgefield" if district_code == 10915 & election == "2017 British general election"
replace district_name = "Sefton Central" if district_code == 10916 & election == "2017 British general election"
replace district_name = "Selby and Ainsty" if district_code == 10917 & election == "2017 British general election"
replace district_name = "Sevenoaks" if district_code == 10918 & election == "2017 British general election"
replace district_name = "Sheffield Central" if district_code == 10919 & election == "2017 British general election"
replace district_name = "Sheffield South East" if district_code == 10920 & election == "2017 British general election"
replace district_name = "Sherwood" if district_code == 10924 & election == "2017 British general election"
replace district_name = "Shipley" if district_code == 10925 & election == "2017 British general election"
replace district_name = "Shrewsbury and Atcham" if district_code == 10926 & election == "2017 British general election"
replace district_name = "Sittingbourne and Sheppey" if district_code == 10927 & election == "2017 British general election"
replace district_name = "Skipton and Ripon" if district_code == 10928 & election == "2017 British general election"
replace district_name = "Sleaford and North Hykeham" if district_code == 10929 & election == "2017 British general election"
replace district_name = "Slough" if district_code == 10930 & election == "2017 British general election"
replace district_name = "Solihull" if district_code == 10931 & election == "2017 British general election"
replace district_name = "Somerton and Frome" if district_code == 10932 & election == "2017 British general election"
replace district_name = "South Basildon and East Thurrock" if district_code == 10933 & election == "2017 British general election"
replace district_name = "South Cambridgeshire" if district_code == 10934 & election == "2017 British general election"
replace district_name = "South Derbyshire" if district_code == 10935 & election == "2017 British general election"
replace district_name = "South Dorset" if district_code == 10936 & election == "2017 British general election"
replace district_name = "South East Cambridgeshire" if district_code == 10937 & election == "2017 British general election"
replace district_name = "South East Cornwall" if district_code == 10938 & election == "2017 British general election"
replace district_name = "South Holland and The Deepings" if district_code == 10939 & election == "2017 British general election"
replace district_name = "South Leicestershire" if district_code == 10940 & election == "2017 British general election"
replace district_name = "South Norfolk" if district_code == 10941 & election == "2017 British general election"
replace district_name = "South Northamptonshire" if district_code == 10942 & election == "2017 British general election"
replace district_name = "South Ribble" if district_code == 10943 & election == "2017 British general election"
replace district_name = "South Shields" if district_code == 10944 & election == "2017 British general election"
replace district_name = "South Staffordshire" if district_code == 10945 & election == "2017 British general election"
replace district_name = "South Suffolk" if district_code == 10946 & election == "2017 British general election"
replace district_name = "South Swindon" if district_code == 10947 & election == "2017 British general election"
replace district_name = "South Thanet" if district_code == 10948 & election == "2017 British general election"
replace district_name = "South West Bedfordshire" if district_code == 10949 & election == "2017 British general election"
replace district_name = "South West Devon" if district_code == 10950 & election == "2017 British general election"
replace district_name = "South West Hertfordshire" if district_code == 10951 & election == "2017 British general election"
replace district_name = "South West Norfolk" if district_code == 10952 & election == "2017 British general election"
replace district_name = "South West Surrey" if district_code == 10953 & election == "2017 British general election"
replace district_name = "South West Wiltshire" if district_code == 10954 & election == "2017 British general election"
replace district_name = "Southend West" if district_code == 10957 & election == "2017 British general election"
replace district_name = "Southport" if district_code == 10958 & election == "2017 British general election"
replace district_name = "Spelthorne" if district_code == 10959 & election == "2017 British general election"
replace district_name = "St Albans" if district_code == 10960 & election == "2017 British general election"
replace district_name = "St Austell and Newquay" if district_code == 10961 & election == "2017 British general election"
replace district_name = "St Helens North" if district_code == 10962 & election == "2017 British general election"
replace district_name = "St Helens South and Whiston" if district_code == 10963 & election == "2017 British general election"
replace district_name = "St Ives" if district_code == 10964 & election == "2017 British general election"
replace district_name = "Stafford" if district_code == 10965 & election == "2017 British general election"
replace district_name = "Staffordshire Moorlands" if district_code == 10966 & election == "2017 British general election"
replace district_name = "Stalybridge and Hyde" if district_code == 10967 & election == "2017 British general election"
replace district_name = "Stevenage" if district_code == 10968 & election == "2017 British general election"
replace district_name = "Stockport" if district_code == 10969 & election == "2017 British general election"
replace district_name = "Stockton North" if district_code == 10970 & election == "2017 British general election"
replace district_name = "Stockton South" if district_code == 10971 & election == "2017 British general election"
replace district_name = "Stoke-On-Trent Central" if district_code == 10972 & election == "2017 British general election"
replace district_name = "Stoke-On-Trent North" if district_code == 10973 & election == "2017 British general election"
replace district_name = "Stoke-On-Trent South" if district_code == 10974 & election == "2017 British general election"
replace district_name = "Stone" if district_code == 10975 & election == "2017 British general election"
replace district_name = "Stourbridge" if district_code == 10976 & election == "2017 British general election"
replace district_name = "Stratford-On-Avon" if district_code == 10977 & election == "2017 British general election"
replace district_name = "Streatham" if district_code == 10978 & election == "2017 British general election"
replace district_name = "Stretford and Urmston" if district_code == 10979 & election == "2017 British general election"
replace district_name = "Stroud" if district_code == 10980 & election == "2017 British general election"
replace district_name = "Suffolk Coastal" if district_code == 10981 & election == "2017 British general election"
replace district_name = "Sunderland Central" if district_code == 10982 & election == "2017 British general election"
replace district_name = "Surrey Heath" if district_code == 10983 & election == "2017 British general election"
replace district_name = "Sutton and Cheam" if district_code == 10984 & election == "2017 British general election"
replace district_name = "Sutton Coldfield" if district_code == 10985 & election == "2017 British general election"
replace district_name = "Tamworth" if district_code == 10986 & election == "2017 British general election"
replace district_name = "Tatton" if district_code == 10987 & election == "2017 British general election"
replace district_name = "Taunton Deane" if district_code == 10988 & election == "2017 British general election"
replace district_name = "Telford" if district_code == 10989 & election == "2017 British general election"
replace district_name = "Tewkesbury" if district_code == 10990 & election == "2017 British general election"
replace district_name = "The Cotswolds" if district_code == 10991 & election == "2017 British general election"
replace district_name = "The Wrekin" if district_code == 10992 & election == "2017 British general election"
replace district_name = "Thirsk and Malton" if district_code == 10993 & election == "2017 British general election"
replace district_name = "Thornbury and Yate" if district_code == 10994 & election == "2017 British general election"
replace district_name = "Thurrock" if district_code == 10995 & election == "2017 British general election"
replace district_name = "Tiverton and Honiton" if district_code == 10996 & election == "2017 British general election"
replace district_name = "Tonbridge and Malling" if district_code == 10997 & election == "2017 British general election"
replace district_name = "Tooting" if district_code == 10998 & election == "2017 British general election"
replace district_name = "Torbay" if district_code == 10999 & election == "2017 British general election"
replace district_name = "Torridge and West Devon" if district_code == 11000 & election == "2017 British general election"
replace district_name = "Totnes" if district_code == 11001 & election == "2017 British general election"
replace district_name = "Tottenham" if district_code == 11002 & election == "2017 British general election"
replace district_name = "Truro and Falmouth" if district_code == 11003 & election == "2017 British general election"
replace district_name = "Tunbridge Wells" if district_code == 11004 & election == "2017 British general election"
replace district_name = "Twickenham" if district_code == 11005 & election == "2017 British general election"
replace district_name = "Tynemouth" if district_code == 11006 & election == "2017 British general election"
replace district_name = "Uxbridge and South Ruislip" if district_code == 11007 & election == "2017 British general election"
replace district_name = "Vauxhall" if district_code == 11008 & election == "2017 British general election"
replace district_name = "Wakefield" if district_code == 11009 & election == "2017 British general election"
replace district_name = "Wallasey" if district_code == 11010 & election == "2017 British general election"
replace district_name = "Walsall North" if district_code == 11011 & election == "2017 British general election"
replace district_name = "Walsall South" if district_code == 11012 & election == "2017 British general election"
replace district_name = "Walthamstow" if district_code == 11013 & election == "2017 British general election"
replace district_name = "Wansbeck" if district_code == 11014 & election == "2017 British general election"
replace district_name = "Wantage" if district_code == 11015 & election == "2017 British general election"
replace district_name = "Warley" if district_code == 11016 & election == "2017 British general election"
replace district_name = "Warrington North" if district_code == 11017 & election == "2017 British general election"
replace district_name = "Warrington South" if district_code == 11018 & election == "2017 British general election"
replace district_name = "Warwick and Leamington" if district_code == 11019 & election == "2017 British general election"
replace district_name = "Washington and Sunderland West" if district_code == 11020 & election == "2017 British general election"
replace district_name = "Watford" if district_code == 11021 & election == "2017 British general election"
replace district_name = "Waveney" if district_code == 11022 & election == "2017 British general election"
replace district_name = "Wealden" if district_code == 11023 & election == "2017 British general election"
replace district_name = "Weaver Vale" if district_code == 11024 & election == "2017 British general election"
replace district_name = "Wellingborough" if district_code == 11025 & election == "2017 British general election"
replace district_name = "Wells" if district_code == 11026 & election == "2017 British general election"
replace district_name = "Welwyn Hatfield" if district_code == 11027 & election == "2017 British general election"
replace district_name = "Wentworth and Dearne" if district_code == 11028 & election == "2017 British general election"
replace district_name = "West Bromwich East" if district_code == 11029 & election == "2017 British general election"
replace district_name = "West Bromwich West" if district_code == 11030 & election == "2017 British general election"
replace district_name = "West Dorset" if district_code == 11031 & election == "2017 British general election"
replace district_name = "West Ham" if district_code == 11032 & election == "2017 British general election"
replace district_name = "West Lancashire" if district_code == 11033 & election == "2017 British general election"
replace district_name = "West Suffolk" if district_code == 11034 & election == "2017 British general election"
replace district_name = "West Worcestershire" if district_code == 11035 & election == "2017 British general election"
replace district_name = "Westminster North" if district_code == 11036 & election == "2017 British general election"
replace district_name = "Westmorland and Lonsdale" if district_code == 11037 & election == "2017 British general election"
replace district_name = "Weston-Super-Mare" if district_code == 11038 & election == "2017 British general election"
replace district_name = "Wigan" if district_code == 11039 & election == "2017 British general election"
replace district_name = "Wimbledon" if district_code == 11040 & election == "2017 British general election"
replace district_name = "Winchester" if district_code == 11041 & election == "2017 British general election"
replace district_name = "Windsor" if district_code == 11042 & election == "2017 British general election"
replace district_name = "Wirral South" if district_code == 11043 & election == "2017 British general election"
replace district_name = "Wirral West" if district_code == 11044 & election == "2017 British general election"
replace district_name = "Witham" if district_code == 11045 & election == "2017 British general election"
replace district_name = "Witney" if district_code == 11046 & election == "2017 British general election"
replace district_name = "Woking" if district_code == 11047 & election == "2017 British general election"
replace district_name = "Wokingham" if district_code == 11048 & election == "2017 British general election"
replace district_name = "Wolverhampton North East" if district_code == 11049 & election == "2017 British general election"
replace district_name = "Wolverhampton South East" if district_code == 11050 & election == "2017 British general election"
replace district_name = "Wolverhampton South West" if district_code == 11051 & election == "2017 British general election"
replace district_name = "Worcester" if district_code == 11052 & election == "2017 British general election"
replace district_name = "Workington" if district_code == 11053 & election == "2017 British general election"
replace district_name = "Worsley and Eccles South" if district_code == 11054 & election == "2017 British general election"
replace district_name = "Worthing West" if district_code == 11055 & election == "2017 British general election"
replace district_name = "Wycombe" if district_code == 11056 & election == "2017 British general election"
replace district_name = "Wyre and Preston North" if district_code == 11057 & election == "2017 British general election"
replace district_name = "Wyre Forest" if district_code == 11058 & election == "2017 British general election"
replace district_name = "Wythenshawe and Sale East" if district_code == 11059 & election == "2017 British general election"
replace district_name = "Yeovil" if district_code == 11060 & election == "2017 British general election"
replace district_name = "York Central" if district_code == 11061 & election == "2017 British general election"
replace district_name = "York Outer" if district_code == 11062 & election == "2017 British general election"
replace district_name = "Belfast East" if district_code == 40001 & election == "2017 British general election"
replace district_name = "Belfast North" if district_code == 40002 & election == "2017 British general election"
replace district_name = "Belfast South" if district_code == 40003 & election == "2017 British general election"
replace district_name = "Belfast West" if district_code == 40004 & election == "2017 British general election"
replace district_name = "East Antrim" if district_code == 40005 & election == "2017 British general election"
replace district_name = "East Londonderry" if district_code == 40006 & election == "2017 British general election"
replace district_name = "Fermanagh and South Tyrone" if district_code == 40007 & election == "2017 British general election"
replace district_name = "Foyle" if district_code == 40008 & election == "2017 British general election"
replace district_name = "Lagan Valley" if district_code == 40009 & election == "2017 British general election"
replace district_name = "Mid Ulster" if district_code == 40010 & election == "2017 British general election"
replace district_name = "Newry and Armagh" if district_code == 40011 & election == "2017 British general election"
replace district_name = "North Antrim" if district_code == 40012 & election == "2017 British general election"
replace district_name = "North Down" if district_code == 40013 & election == "2017 British general election"
replace district_name = "South Antrim" if district_code == 40014 & election == "2017 British general election"
replace district_name = "South Down" if district_code == 40015 & election == "2017 British general election"
replace district_name = "Strangford" if district_code == 40016 & election == "2017 British general election"
replace district_name = "Upper Bann" if district_code == 40017 & election == "2017 British general election"
replace district_name = "West Tyrone" if district_code == 40018 & election == "2017 British general election"
replace district_name = "Aberdeen North" if district_code == 20001 & election == "2017 British general election"
replace district_name = "Aberdeen South" if district_code == 20002 & election == "2017 British general election"
replace district_name = "Airdrie and Shotts" if district_code == 20003 & election == "2017 British general election"
replace district_name = "Angus" if district_code == 20004 & election == "2017 British general election"
replace district_name = "Argyll and Bute" if district_code == 20005 & election == "2017 British general election"
replace district_name = "Banff and Buchan" if district_code == 20007 & election == "2017 British general election"
replace district_name = "Berwickshire, Roxburgh and Selkirk" if district_code == 20008 & election == "2017 British general election"
replace district_name = "Central Ayrshire" if district_code == 20010 & election == "2017 British general election"
replace district_name = "Dumfries and Galloway" if district_code == 20013 & election == "2017 British general election"
replace district_name = "Dundee East" if district_code == 20015 & election == "2017 British general election"
replace district_name = "Dundee West" if district_code == 20016 & election == "2017 British general election"
replace district_name = "Dunfermline and West Fife" if district_code == 20017 & election == "2017 British general election"
replace district_name = "East Dunbartonshire" if district_code == 20018 & election == "2017 British general election"
replace district_name = "East Lothian" if district_code == 20020 & election == "2017 British general election"
replace district_name = "East Renfrewshire" if district_code == 20021 & election == "2017 British general election"
replace district_name = "Edinburgh East" if district_code == 20022 & election == "2017 British general election"
replace district_name = "Edinburgh North and Leith" if district_code == 20023 & election == "2017 British general election"
replace district_name = "Edinburgh South" if district_code == 20024 & election == "2017 British general election"
replace district_name = "Edinburgh South West" if district_code == 20025 & election == "2017 British general election"
replace district_name = "Edinburgh West" if district_code == 20026 & election == "2017 British general election"
replace district_name = "Na h-Eileanan An Iar" if district_code == 20027 & election == "2017 British general election"
replace district_name = "Falkirk" if district_code == 20028 & election == "2017 British general election"
replace district_name = "Glasgow Central" if district_code == 20029 & election == "2017 British general election"
replace district_name = "Glasgow East" if district_code == 20030 & election == "2017 British general election"
replace district_name = "Glasgow North" if district_code == 20031 & election == "2017 British general election"
replace district_name = "Glasgow North East" if district_code == 20032 & election == "2017 British general election"
replace district_name = "Glasgow North West" if district_code == 20033 & election == "2017 British general election"
replace district_name = "Glasgow South" if district_code == 20034 & election == "2017 British general election"
replace district_name = "Glasgow South West" if district_code == 20035 & election == "2017 British general election"
replace district_name = "Glenrothes" if district_code == 20036 & election == "2017 British general election"
replace district_name = "Gordon" if district_code == 20037 & election == "2017 British general election"
replace district_name = "Inverclyde" if district_code == 20038 & election == "2017 British general election"
replace district_name = "Kilmarnock and Loudoun" if district_code == 20040 & election == "2017 British general election"
replace district_name = "Kirkcaldy and Cowdenbeath" if district_code == 20041 & election == "2017 British general election"
replace district_name = "Lanark and Hamilton East" if district_code == 20042 & election == "2017 British general election"
replace district_name = "Linlithgow and East Falkirk" if district_code == 20043 & election == "2017 British general election"
replace district_name = "Livingston" if district_code == 20044 & election == "2017 British general election"
replace district_name = "Midlothian" if district_code == 20045 & election == "2017 British general election"
replace district_name = "Moray" if district_code == 20046 & election == "2017 British general election"
replace district_name = "Motherwell and Wishaw" if district_code == 20047 & election == "2017 British general election"
replace district_name = "North Ayrshire and Arran" if district_code == 20048 & election == "2017 British general election"
replace district_name = "North East Fife" if district_code == 20049 & election == "2017 British general election"
replace district_name = "Ochil and South Perthshire" if district_code == 20050 & election == "2017 British general election"
replace district_name = "Orkney and Shetland" if district_code == 20051 & election == "2017 British general election"
replace district_name = "Paisley and Renfrewshire North" if district_code == 20052 & election == "2017 British general election"
replace district_name = "Paisley and Renfrewshire South" if district_code == 20053 & election == "2017 British general election"
replace district_name = "Perth and North Perthshire" if district_code == 20054 & election == "2017 British general election"
replace district_name = "Rutherglen and Hamilton West" if district_code == 20056 & election == "2017 British general election"
replace district_name = "Stirling" if district_code == 20057 & election == "2017 British general election"
replace district_name = "West Aberdeenshire and Kincardine" if district_code == 20058 & election == "2017 British general election"
replace district_name = "West Dunbartonshire" if district_code == 20059 & election == "2017 British general election"
replace district_name = "Ynys Mon" if district_code == 30041 & election == "2017 British general election"
replace district_name = "Delyn" if district_code == 30042 & election == "2017 British general election"
replace district_name = "Alyn and Deeside" if district_code == 30043 & election == "2017 British general election"
replace district_name = "Wrexham" if district_code == 30044 & election == "2017 British general election"
replace district_name = "Llanelli" if district_code == 30045 & election == "2017 British general election"
replace district_name = "Gower" if district_code == 30046 & election == "2017 British general election"
replace district_name = "Swansea West" if district_code == 30047 & election == "2017 British general election"
replace district_name = "Swansea East" if district_code == 30048 & election == "2017 British general election"
replace district_name = "Aberavon" if district_code == 30049 & election == "2017 British general election"
replace district_name = "Cardiff Central" if district_code == 30050 & election == "2017 British general election"
replace district_name = "Cardiff North" if district_code == 30051 & election == "2017 British general election"
replace district_name = "Rhondda" if district_code == 30052 & election == "2017 British general election"
replace district_name = "Torfaen" if district_code == 30053 & election == "2017 British general election"
replace district_name = "Monmouth" if district_code == 30054 & election == "2017 British general election"
replace district_name = "Newport East" if district_code == 30055 & election == "2017 British general election"
replace district_name = "Newport West" if district_code == 30056 & election == "2017 British general election"
replace district_name = "Arfon" if district_code == 30057 & election == "2017 British general election"
replace district_name = "Aberconwy" if district_code == 30058 & election == "2017 British general election"
replace district_name = "Clwyd West" if district_code == 30059 & election == "2017 British general election"
replace district_name = "Vale Of Clwyd" if district_code == 30060 & election == "2017 British general election"
replace district_name = "Dwyfor Meirionnydd" if district_code == 30061 & election == "2017 British general election"
replace district_name = "Clwyd South" if district_code == 30062 & election == "2017 British general election"
replace district_name = "Montgomeryshire" if district_code == 30063 & election == "2017 British general election"
replace district_name = "Ceredigion" if district_code == 30064 & election == "2017 British general election"
replace district_name = "Preseli Pembrokeshire" if district_code == 30065 & election == "2017 British general election"
replace district_name = "Carmarthen West and South Pembrokeshire" if district_code == 30066 & election == "2017 British general election"
replace district_name = "Carmarthen East and Dinefwr" if district_code == 30067 & election == "2017 British general election"
replace district_name = "Brecon and Radnorshire" if district_code == 30068 & election == "2017 British general election"
replace district_name = "Neath" if district_code == 30069 & election == "2017 British general election"
replace district_name = "Cynon Valley" if district_code == 30070 & election == "2017 British general election"
replace district_name = "Merthyr Tydfil and Rhymney" if district_code == 30071 & election == "2017 British general election"
replace district_name = "Blaenau Gwent" if district_code == 30072 & election == "2017 British general election"
replace district_name = "Bridgend" if district_code == 30073 & election == "2017 British general election"
replace district_name = "Ogmore" if district_code == 30074 & election == "2017 British general election"
replace district_name = "Pontypridd" if district_code == 30075 & election == "2017 British general election"
replace district_name = "Caerphilly" if district_code == 30076 & election == "2017 British general election"
replace district_name = "Islwyn" if district_code == 30077 & election == "2017 British general election"
replace district_name = "Vale Of Glamorgan" if district_code == 30078 & election == "2017 British general election"
replace district_name = "Cardiff West" if district_code == 30079 & election == "2017 British general election"
replace district_name = "Cardiff South and Penarth" if district_code == 30080 & election == "2017 British general election"
replace district_name = "Aldershot" if district_code == 10530 & election == "2019 British general election"
replace district_name = "Aldridge-Brownhills" if district_code == 10531 & election == "2019 British general election"
replace district_name = "Altrincham and Sale West" if district_code == 10532 & election == "2019 British general election"
replace district_name = "Amber Valley" if district_code == 10533 & election == "2019 British general election"
replace district_name = "Arundel and South Downs" if district_code == 10534 & election == "2019 British general election"
replace district_name = "Ashfield" if district_code == 10535 & election == "2019 British general election"
replace district_name = "Ashford" if district_code == 10536 & election == "2019 British general election"
replace district_name = "Ashton-Under-Lyne" if district_code == 10537 & election == "2019 British general election"
replace district_name = "Aylesbury" if district_code == 10538 & election == "2019 British general election"
replace district_name = "Banbury" if district_code == 10539 & election == "2019 British general election"
replace district_name = "Barking" if district_code == 10540 & election == "2019 British general election"
replace district_name = "Barnsley Central" if district_code == 10541 & election == "2019 British general election"
replace district_name = "Barnsley East" if district_code == 10542 & election == "2019 British general election"
replace district_name = "Barrow and Furness" if district_code == 10543 & election == "2019 British general election"
replace district_name = "Basildon and Billericay" if district_code == 10544 & election == "2019 British general election"
replace district_name = "Basingstoke" if district_code == 10545 & election == "2019 British general election"
replace district_name = "Bassetlaw" if district_code == 10546 & election == "2019 British general election"
replace district_name = "Bath" if district_code == 10547 & election == "2019 British general election"
replace district_name = "Batley and Spen" if district_code == 10548 & election == "2019 British general election"
replace district_name = "Battersea" if district_code == 10549 & election == "2019 British general election"
replace district_name = "Beaconsfield" if district_code == 10550 & election == "2019 British general election"
replace district_name = "Beckenham" if district_code == 10551 & election == "2019 British general election"
replace district_name = "Bedford" if district_code == 10552 & election == "2019 British general election"
replace district_name = "Bermondsey and Old Southwark" if district_code == 10553 & election == "2019 British general election"
replace district_name = "Berwick-Upon-Tweed" if district_code == 10554 & election == "2019 British general election"
replace district_name = "Bethnal Green and Bow" if district_code == 10555 & election == "2019 British general election"
replace district_name = "Beverley and Holderness" if district_code == 10556 & election == "2019 British general election"
replace district_name = "Bexhill and Battle" if district_code == 10557 & election == "2019 British general election"
replace district_name = "Bexleyheath and Crayford" if district_code == 10558 & election == "2019 British general election"
replace district_name = "Birkenhead" if district_code == 10559 & election == "2019 British general election"
replace district_name = "Birmingham, Edgbaston" if district_code == 10560 & election == "2019 British general election"
replace district_name = "Birmingham, Erdington" if district_code == 10561 & election == "2019 British general election"
replace district_name = "Birmingham, Hall Green" if district_code == 10562 & election == "2019 British general election"
replace district_name = "Birmingham, Hodge Hill" if district_code == 10563 & election == "2019 British general election"
replace district_name = "Birmingham, Ladywood" if district_code == 10564 & election == "2019 British general election"
replace district_name = "Birmingham, Northfield" if district_code == 10565 & election == "2019 British general election"
replace district_name = "Birmingham, Perry Barr" if district_code == 10566 & election == "2019 British general election"
replace district_name = "Birmingham, Selly Oak" if district_code == 10567 & election == "2019 British general election"
replace district_name = "Birmingham, Yardley" if district_code == 10568 & election == "2019 British general election"
replace district_name = "Bishop Auckland" if district_code == 10569 & election == "2019 British general election"
replace district_name = "Blackburn" if district_code == 10570 & election == "2019 British general election"
replace district_name = "Blackley and Broughton" if district_code == 10571 & election == "2019 British general election"
replace district_name = "Blackpool North and Cleveleys" if district_code == 10572 & election == "2019 British general election"
replace district_name = "Blackpool South" if district_code == 10573 & election == "2019 British general election"
replace district_name = "Blaydon" if district_code == 10574 & election == "2019 British general election"
replace district_name = "Blyth Valley" if district_code == 10575 & election == "2019 British general election"
replace district_name = "Bognor Regis and Littlehampton" if district_code == 10576 & election == "2019 British general election"
replace district_name = "Bolsover" if district_code == 10577 & election == "2019 British general election"
replace district_name = "Bolton North East" if district_code == 10578 & election == "2019 British general election"
replace district_name = "Bolton South East" if district_code == 10579 & election == "2019 British general election"
replace district_name = "Bolton West" if district_code == 10580 & election == "2019 British general election"
replace district_name = "Bootle" if district_code == 10581 & election == "2019 British general election"
replace district_name = "Boston and Skegness" if district_code == 10582 & election == "2019 British general election"
replace district_name = "Bosworth" if district_code == 10583 & election == "2019 British general election"
replace district_name = "Bournemouth East" if district_code == 10584 & election == "2019 British general election"
replace district_name = "Bournemouth West" if district_code == 10585 & election == "2019 British general election"
replace district_name = "Bracknell" if district_code == 10586 & election == "2019 British general election"
replace district_name = "Bradford East" if district_code == 10587 & election == "2019 British general election"
replace district_name = "Bradford South" if district_code == 10588 & election == "2019 British general election"
replace district_name = "Bradford West" if district_code == 10589 & election == "2019 British general election"
replace district_name = "Braintree" if district_code == 10590 & election == "2019 British general election"
replace district_name = "Brent Central" if district_code == 10591 & election == "2019 British general election"
replace district_name = "Brent North" if district_code == 10592 & election == "2019 British general election"
replace district_name = "Brentford and Isleworth" if district_code == 10593 & election == "2019 British general election"
replace district_name = "Brentwood and Ongar" if district_code == 10594 & election == "2019 British general election"
replace district_name = "Bridgwater and West Somerset" if district_code == 10595 & election == "2019 British general election"
replace district_name = "Brigg and Goole" if district_code == 10596 & election == "2019 British general election"
replace district_name = "Brighton, Kemptown" if district_code == 10597 & election == "2019 British general election"
replace district_name = "Brighton, Pavilion" if district_code == 10598 & election == "2019 British general election"
replace district_name = "Bristol East" if district_code == 10599 & election == "2019 British general election"
replace district_name = "Bristol North West" if district_code == 10600 & election == "2019 British general election"
replace district_name = "Bristol South" if district_code == 10601 & election == "2019 British general election"
replace district_name = "Bristol West" if district_code == 10602 & election == "2019 British general election"
replace district_name = "Broadland" if district_code == 10603 & election == "2019 British general election"
replace district_name = "Bromley and Chislehurst" if district_code == 10604 & election == "2019 British general election"
replace district_name = "Bromsgrove" if district_code == 10605 & election == "2019 British general election"
replace district_name = "Broxbourne" if district_code == 10606 & election == "2019 British general election"
replace district_name = "Broxtowe" if district_code == 10607 & election == "2019 British general election"
replace district_name = "Buckingham" if district_code == 10608 & election == "2019 British general election"
replace district_name = "Burnley" if district_code == 10609 & election == "2019 British general election"
replace district_name = "Burton" if district_code == 10610 & election == "2019 British general election"
replace district_name = "Bury North" if district_code == 10611 & election == "2019 British general election"
replace district_name = "Bury South" if district_code == 10612 & election == "2019 British general election"
replace district_name = "Bury St Edmunds" if district_code == 10613 & election == "2019 British general election"
replace district_name = "Calder Valley" if district_code == 10614 & election == "2019 British general election"
replace district_name = "Camberwell and Peckham" if district_code == 10615 & election == "2019 British general election"
replace district_name = "Camborne and Redruth" if district_code == 10616 & election == "2019 British general election"
replace district_name = "Cambridge" if district_code == 10617 & election == "2019 British general election"
replace district_name = "Cannock Chase" if district_code == 10618 & election == "2019 British general election"
replace district_name = "Canterbury" if district_code == 10619 & election == "2019 British general election"
replace district_name = "Carlisle" if district_code == 10620 & election == "2019 British general election"
replace district_name = "Carshalton and Wallington" if district_code == 10621 & election == "2019 British general election"
replace district_name = "Castle Point" if district_code == 10622 & election == "2019 British general election"
replace district_name = "Central Devon" if district_code == 10623 & election == "2019 British general election"
replace district_name = "Central Suffolk and North Ipswich" if district_code == 10624 & election == "2019 British general election"
replace district_name = "Charnwood" if district_code == 10625 & election == "2019 British general election"
replace district_name = "Chatham and Aylesford" if district_code == 10626 & election == "2019 British general election"
replace district_name = "Cheadle" if district_code == 10627 & election == "2019 British general election"
replace district_name = "Chelmsford" if district_code == 10628 & election == "2019 British general election"
replace district_name = "Chelsea and Fulham" if district_code == 10629 & election == "2019 British general election"
replace district_name = "Cheltenham" if district_code == 10630 & election == "2019 British general election"
replace district_name = "Chesham and Amersham" if district_code == 10631 & election == "2019 British general election"
replace district_name = "Chesterfield" if district_code == 10632 & election == "2019 British general election"
replace district_name = "Chichester" if district_code == 10633 & election == "2019 British general election"
replace district_name = "Chingford and Woodford Green" if district_code == 10634 & election == "2019 British general election"
replace district_name = "Chippenham" if district_code == 10635 & election == "2019 British general election"
replace district_name = "Chipping Barnet" if district_code == 10636 & election == "2019 British general election"
replace district_name = "Chorley" if district_code == 10637 & election == "2019 British general election"
replace district_name = "Christchurch" if district_code == 10638 & election == "2019 British general election"
replace district_name = "Cities Of London and Westminster" if district_code == 10639 & election == "2019 British general election"
replace district_name = "City Of Chester" if district_code == 10640 & election == "2019 British general election"
replace district_name = "City Of Durham" if district_code == 10641 & election == "2019 British general election"
replace district_name = "Clacton" if district_code == 10642 & election == "2019 British general election"
replace district_name = "Cleethorpes" if district_code == 10643 & election == "2019 British general election"
replace district_name = "Colchester" if district_code == 10644 & election == "2019 British general election"
replace district_name = "Colne Valley" if district_code == 10645 & election == "2019 British general election"
replace district_name = "Congleton" if district_code == 10646 & election == "2019 British general election"
replace district_name = "Copeland" if district_code == 10647 & election == "2019 British general election"
replace district_name = "Corby" if district_code == 10648 & election == "2019 British general election"
replace district_name = "Coventry North East" if district_code == 10649 & election == "2019 British general election"
replace district_name = "Coventry North West" if district_code == 10650 & election == "2019 British general election"
replace district_name = "Coventry South" if district_code == 10651 & election == "2019 British general election"
replace district_name = "Crawley" if district_code == 10652 & election == "2019 British general election"
replace district_name = "Crewe and Nantwich" if district_code == 10653 & election == "2019 British general election"
replace district_name = "Croydon Central" if district_code == 10654 & election == "2019 British general election"
replace district_name = "Croydon North" if district_code == 10655 & election == "2019 British general election"
replace district_name = "Croydon South" if district_code == 10656 & election == "2019 British general election"
replace district_name = "Dagenham and Rainham" if district_code == 10657 & election == "2019 British general election"
replace district_name = "Darlington" if district_code == 10658 & election == "2019 British general election"
replace district_name = "Dartford" if district_code == 10659 & election == "2019 British general election"
replace district_name = "Daventry" if district_code == 10660 & election == "2019 British general election"
replace district_name = "Denton and Reddish" if district_code == 10661 & election == "2019 British general election"
replace district_name = "Derby North" if district_code == 10662 & election == "2019 British general election"
replace district_name = "Derby South" if district_code == 10663 & election == "2019 British general election"
replace district_name = "Derbyshire Dales" if district_code == 10664 & election == "2019 British general election"
replace district_name = "Devizes" if district_code == 10665 & election == "2019 British general election"
replace district_name = "Dewsbury" if district_code == 10666 & election == "2019 British general election"
replace district_name = "Don Valley" if district_code == 10667 & election == "2019 British general election"
replace district_name = "Doncaster Central" if district_code == 10668 & election == "2019 British general election"
replace district_name = "Doncaster North" if district_code == 10669 & election == "2019 British general election"
replace district_name = "Dover" if district_code == 10670 & election == "2019 British general election"
replace district_name = "Dudley North" if district_code == 10671 & election == "2019 British general election"
replace district_name = "Dudley South" if district_code == 10672 & election == "2019 British general election"
replace district_name = "Dulwich and West Norwood" if district_code == 10673 & election == "2019 British general election"
replace district_name = "Ealing Central and Acton" if district_code == 10674 & election == "2019 British general election"
replace district_name = "Ealing North" if district_code == 10675 & election == "2019 British general election"
replace district_name = "Ealing, Southall" if district_code == 10676 & election == "2019 British general election"
replace district_name = "Easington" if district_code == 10677 & election == "2019 British general election"
replace district_name = "East Devon" if district_code == 10678 & election == "2019 British general election"
replace district_name = "East Ham" if district_code == 10679 & election == "2019 British general election"
replace district_name = "East Hampshire" if district_code == 10680 & election == "2019 British general election"
replace district_name = "East Surrey" if district_code == 10681 & election == "2019 British general election"
replace district_name = "East Worthing and Shoreham" if district_code == 10682 & election == "2019 British general election"
replace district_name = "East Yorkshire" if district_code == 10683 & election == "2019 British general election"
replace district_name = "Eastbourne" if district_code == 10684 & election == "2019 British general election"
replace district_name = "Eastleigh" if district_code == 10685 & election == "2019 British general election"
replace district_name = "Eddisbury" if district_code == 10686 & election == "2019 British general election"
replace district_name = "Edmonton" if district_code == 10687 & election == "2019 British general election"
replace district_name = "Ellesmere Port and Neston" if district_code == 10688 & election == "2019 British general election"
replace district_name = "Elmet and Rothwell" if district_code == 10689 & election == "2019 British general election"
replace district_name = "Eltham" if district_code == 10690 & election == "2019 British general election"
replace district_name = "Enfield North" if district_code == 10691 & election == "2019 British general election"
replace district_name = "Enfield, Southgate" if district_code == 10692 & election == "2019 British general election"
replace district_name = "Epping Forest" if district_code == 10693 & election == "2019 British general election"
replace district_name = "Epsom and Ewell" if district_code == 10694 & election == "2019 British general election"
replace district_name = "Erewash" if district_code == 10695 & election == "2019 British general election"
replace district_name = "Erith and Thamesmead" if district_code == 10696 & election == "2019 British general election"
replace district_name = "Esher and Walton" if district_code == 10697 & election == "2019 British general election"
replace district_name = "Exeter" if district_code == 10698 & election == "2019 British general election"
replace district_name = "Fareham" if district_code == 10699 & election == "2019 British general election"
replace district_name = "Faversham and Mid Kent" if district_code == 10700 & election == "2019 British general election"
replace district_name = "Feltham and Heston" if district_code == 10701 & election == "2019 British general election"
replace district_name = "Filton and Bradley Stoke" if district_code == 10702 & election == "2019 British general election"
replace district_name = "Finchley and Golders Green" if district_code == 10703 & election == "2019 British general election"
replace district_name = "Folkestone and Hythe" if district_code == 10704 & election == "2019 British general election"
replace district_name = "Forest Of Dean" if district_code == 10705 & election == "2019 British general election"
replace district_name = "Fylde" if district_code == 10706 & election == "2019 British general election"
replace district_name = "Gainsborough" if district_code == 10707 & election == "2019 British general election"
replace district_name = "Garston and Halewood" if district_code == 10708 & election == "2019 British general election"
replace district_name = "Gateshead" if district_code == 10709 & election == "2019 British general election"
replace district_name = "Gedling" if district_code == 10710 & election == "2019 British general election"
replace district_name = "Gillingham and Rainham" if district_code == 10711 & election == "2019 British general election"
replace district_name = "Gloucester" if district_code == 10712 & election == "2019 British general election"
replace district_name = "Gosport" if district_code == 10713 & election == "2019 British general election"
replace district_name = "Grantham and Stamford" if district_code == 10714 & election == "2019 British general election"
replace district_name = "Gravesham" if district_code == 10715 & election == "2019 British general election"
replace district_name = "Great Grimsby" if district_code == 10716 & election == "2019 British general election"
replace district_name = "Great Yarmouth" if district_code == 10717 & election == "2019 British general election"
replace district_name = "Greenwich and Woolwich" if district_code == 10718 & election == "2019 British general election"
replace district_name = "Guildford" if district_code == 10719 & election == "2019 British general election"
replace district_name = "Hackney North and Stoke Newington" if district_code == 10720 & election == "2019 British general election"
replace district_name = "Hackney South and Shoreditch" if district_code == 10721 & election == "2019 British general election"
replace district_name = "Halesowen and Rowley Regis" if district_code == 10722 & election == "2019 British general election"
replace district_name = "Halifax" if district_code == 10723 & election == "2019 British general election"
replace district_name = "Haltemprice and Howden" if district_code == 10724 & election == "2019 British general election"
replace district_name = "Halton" if district_code == 10725 & election == "2019 British general election"
replace district_name = "Hammersmith" if district_code == 10726 & election == "2019 British general election"
replace district_name = "Hampstead and Kilburn" if district_code == 10727 & election == "2019 British general election"
replace district_name = "Harborough" if district_code == 10728 & election == "2019 British general election"
replace district_name = "Harlow" if district_code == 10729 & election == "2019 British general election"
replace district_name = "Harrogate and Knaresborough" if district_code == 10730 & election == "2019 British general election"
replace district_name = "Harrow East" if district_code == 10731 & election == "2019 British general election"
replace district_name = "Harrow West" if district_code == 10732 & election == "2019 British general election"
replace district_name = "Hartlepool" if district_code == 10733 & election == "2019 British general election"
replace district_name = "Harwich and North Essex" if district_code == 10734 & election == "2019 British general election"
replace district_name = "Hastings and Rye" if district_code == 10735 & election == "2019 British general election"
replace district_name = "Havant" if district_code == 10736 & election == "2019 British general election"
replace district_name = "Hayes and Harlington" if district_code == 10737 & election == "2019 British general election"
replace district_name = "Hazel Grove" if district_code == 10738 & election == "2019 British general election"
replace district_name = "Hemel Hempstead" if district_code == 10739 & election == "2019 British general election"
replace district_name = "Hemsworth" if district_code == 10740 & election == "2019 British general election"
replace district_name = "Hendon" if district_code == 10741 & election == "2019 British general election"
replace district_name = "Henley" if district_code == 10742 & election == "2019 British general election"
replace district_name = "Hereford and South Herefordshire" if district_code == 10743 & election == "2019 British general election"
replace district_name = "Hertford and Stortford" if district_code == 10744 & election == "2019 British general election"
replace district_name = "Hertsmere" if district_code == 10745 & election == "2019 British general election"
replace district_name = "Hexham" if district_code == 10746 & election == "2019 British general election"
replace district_name = "Heywood and Middleton" if district_code == 10747 & election == "2019 British general election"
replace district_name = "High Peak" if district_code == 10748 & election == "2019 British general election"
replace district_name = "Hitchin and Harpenden" if district_code == 10749 & election == "2019 British general election"
replace district_name = "Holborn and St Pancras" if district_code == 10750 & election == "2019 British general election"
replace district_name = "Hornchurch and Upminster" if district_code == 10751 & election == "2019 British general election"
replace district_name = "Hornsey and Wood Green" if district_code == 10752 & election == "2019 British general election"
replace district_name = "Horsham" if district_code == 10753 & election == "2019 British general election"
replace district_name = "Houghton and Sunderland South" if district_code == 10754 & election == "2019 British general election"
replace district_name = "Hove" if district_code == 10755 & election == "2019 British general election"
replace district_name = "Huddersfield" if district_code == 10756 & election == "2019 British general election"
replace district_name = "Huntingdon" if district_code == 10757 & election == "2019 British general election"
replace district_name = "Hyndburn" if district_code == 10758 & election == "2019 British general election"
replace district_name = "Ilford North" if district_code == 10759 & election == "2019 British general election"
replace district_name = "Ilford South" if district_code == 10760 & election == "2019 British general election"
replace district_name = "Ipswich" if district_code == 10761 & election == "2019 British general election"
replace district_name = "Isle Of Wight" if district_code == 10762 & election == "2019 British general election"
replace district_name = "Islington North" if district_code == 10763 & election == "2019 British general election"
replace district_name = "Islington South and Finsbury" if district_code == 10764 & election == "2019 British general election"
replace district_name = "Jarrow" if district_code == 10765 & election == "2019 British general election"
replace district_name = "Keighley" if district_code == 10766 & election == "2019 British general election"
replace district_name = "Kenilworth and Southam" if district_code == 10767 & election == "2019 British general election"
replace district_name = "Kensington" if district_code == 10768 & election == "2019 British general election"
replace district_name = "Kettering" if district_code == 10769 & election == "2019 British general election"
replace district_name = "Kingston and Surbiton" if district_code == 10770 & election == "2019 British general election"
replace district_name = "Kingston upon Hull East" if district_code == 10771 & election == "2019 British general election"
replace district_name = "Kingston upon Hull North" if district_code == 10772 & election == "2019 British general election"
replace district_name = "Kingston upon Hull West and Hessle" if district_code == 10773 & election == "2019 British general election"
replace district_name = "Kingswood" if district_code == 10774 & election == "2019 British general election"
replace district_name = "Knowsley" if district_code == 10775 & election == "2019 British general election"
replace district_name = "Lancaster and Fleetwood" if district_code == 10776 & election == "2019 British general election"
replace district_name = "Leeds Central" if district_code == 10777 & election == "2019 British general election"
replace district_name = "Leeds East" if district_code == 10778 & election == "2019 British general election"
replace district_name = "Leeds North East" if district_code == 10779 & election == "2019 British general election"
replace district_name = "Leeds North West" if district_code == 10780 & election == "2019 British general election"
replace district_name = "Leeds West" if district_code == 10781 & election == "2019 British general election"
replace district_name = "Leicester East" if district_code == 10782 & election == "2019 British general election"
replace district_name = "Leicester South" if district_code == 10783 & election == "2019 British general election"
replace district_name = "Leicester West" if district_code == 10784 & election == "2019 British general election"
replace district_name = "Leigh" if district_code == 10785 & election == "2019 British general election"
replace district_name = "Lewes" if district_code == 10786 & election == "2019 British general election"
replace district_name = "Lewisham East" if district_code == 10787 & election == "2019 British general election"
replace district_name = "Lewisham West and Penge" if district_code == 10788 & election == "2019 British general election"
replace district_name = "Lewisham, Deptford" if district_code == 10789 & election == "2019 British general election"
replace district_name = "Leyton and Wanstead" if district_code == 10790 & election == "2019 British general election"
replace district_name = "Lichfield" if district_code == 10791 & election == "2019 British general election"
replace district_name = "Lincoln" if district_code == 10792 & election == "2019 British general election"
replace district_name = "Liverpool, Riverside" if district_code == 10793 & election == "2019 British general election"
replace district_name = "Liverpool, Walton" if district_code == 10794 & election == "2019 British general election"
replace district_name = "Liverpool, Wavertree" if district_code == 10795 & election == "2019 British general election"
replace district_name = "Liverpool, West Derby" if district_code == 10796 & election == "2019 British general election"
replace district_name = "Loughborough" if district_code == 10797 & election == "2019 British general election"
replace district_name = "Louth and Horncastle" if district_code == 10798 & election == "2019 British general election"
replace district_name = "Ludlow" if district_code == 10799 & election == "2019 British general election"
replace district_name = "Luton North" if district_code == 10800 & election == "2019 British general election"
replace district_name = "Luton South" if district_code == 10801 & election == "2019 British general election"
replace district_name = "Macclesfield" if district_code == 10802 & election == "2019 British general election"
replace district_name = "Maidenhead" if district_code == 10803 & election == "2019 British general election"
replace district_name = "Maidstone and The Weald" if district_code == 10804 & election == "2019 British general election"
replace district_name = "Makerfield" if district_code == 10805 & election == "2019 British general election"
replace district_name = "Maldon" if district_code == 10806 & election == "2019 British general election"
replace district_name = "Manchester Central" if district_code == 10807 & election == "2019 British general election"
replace district_name = "Manchester, Gorton" if district_code == 10808 & election == "2019 British general election"
replace district_name = "Manchester, Withington" if district_code == 10809 & election == "2019 British general election"
replace district_name = "Mansfield" if district_code == 10810 & election == "2019 British general election"
replace district_name = "Meon Valley" if district_code == 10811 & election == "2019 British general election"
replace district_name = "Meriden" if district_code == 10812 & election == "2019 British general election"
replace district_name = "Mid Bedfordshire" if district_code == 10813 & election == "2019 British general election"
replace district_name = "Mid Derbyshire" if district_code == 10814 & election == "2019 British general election"
replace district_name = "Mid Dorset and North Poole" if district_code == 10815 & election == "2019 British general election"
replace district_name = "Mid Norfolk" if district_code == 10816 & election == "2019 British general election"
replace district_name = "Mid Sussex" if district_code == 10817 & election == "2019 British general election"
replace district_name = "Mid Worcestershire" if district_code == 10818 & election == "2019 British general election"
replace district_name = "Middlesbrough" if district_code == 10819 & election == "2019 British general election"
replace district_name = "Middlesbrough South and East Cleveland" if district_code == 10820 & election == "2019 British general election"
replace district_name = "Milton Keynes North" if district_code == 10821 & election == "2019 British general election"
replace district_name = "Milton Keynes South" if district_code == 10822 & election == "2019 British general election"
replace district_name = "Mitcham and Morden" if district_code == 10823 & election == "2019 British general election"
replace district_name = "Mole Valley" if district_code == 10824 & election == "2019 British general election"
replace district_name = "Morecambe and Lunesdale" if district_code == 10825 & election == "2019 British general election"
replace district_name = "Morley and Outwood" if district_code == 10826 & election == "2019 British general election"
replace district_name = "New Forest East" if district_code == 10827 & election == "2019 British general election"
replace district_name = "New Forest West" if district_code == 10828 & election == "2019 British general election"
replace district_name = "Newark" if district_code == 10829 & election == "2019 British general election"
replace district_name = "Newbury" if district_code == 10830 & election == "2019 British general election"
replace district_name = "Newcastle Upon Tyne Central" if district_code == 10831 & election == "2019 British general election"
replace district_name = "Newcastle Upon Tyne East" if district_code == 10832 & election == "2019 British general election"
replace district_name = "Newcastle Upon Tyne North" if district_code == 10833 & election == "2019 British general election"
replace district_name = "Newcastle-Under-Lyme" if district_code == 10834 & election == "2019 British general election"
replace district_name = "Newton Abbot" if district_code == 10835 & election == "2019 British general election"
replace district_name = "Normanton, Pontefract and Castleford" if district_code == 10836 & election == "2019 British general election"
replace district_name = "North Cornwall" if district_code == 10837 & election == "2019 British general election"
replace district_name = "North Devon" if district_code == 10838 & election == "2019 British general election"
replace district_name = "North Dorset" if district_code == 10839 & election == "2019 British general election"
replace district_name = "North Durham" if district_code == 10840 & election == "2019 British general election"
replace district_name = "North East Bedfordshire" if district_code == 10841 & election == "2019 British general election"
replace district_name = "North East Cambridgeshire" if district_code == 10842 & election == "2019 British general election"
replace district_name = "North East Derbyshire" if district_code == 10843 & election == "2019 British general election"
replace district_name = "North East Hampshire" if district_code == 10844 & election == "2019 British general election"
replace district_name = "North East Hertfordshire" if district_code == 10845 & election == "2019 British general election"
replace district_name = "North East Somerset" if district_code == 10846 & election == "2019 British general election"
replace district_name = "North Herefordshire" if district_code == 10847 & election == "2019 British general election"
replace district_name = "North Norfolk" if district_code == 10848 & election == "2019 British general election"
replace district_name = "North Shropshire" if district_code == 10849 & election == "2019 British general election"
replace district_name = "North Somerset" if district_code == 10850 & election == "2019 British general election"
replace district_name = "North Swindon" if district_code == 10851 & election == "2019 British general election"
replace district_name = "North Thanet" if district_code == 10852 & election == "2019 British general election"
replace district_name = "North Tyneside" if district_code == 10853 & election == "2019 British general election"
replace district_name = "North Warwickshire" if district_code == 10854 & election == "2019 British general election"
replace district_name = "North West Cambridgeshire" if district_code == 10855 & election == "2019 British general election"
replace district_name = "North West Durham" if district_code == 10856 & election == "2019 British general election"
replace district_name = "North West Hampshire" if district_code == 10857 & election == "2019 British general election"
replace district_name = "North West Leicestershire" if district_code == 10858 & election == "2019 British general election"
replace district_name = "North West Norfolk" if district_code == 10859 & election == "2019 British general election"
replace district_name = "North Wiltshire" if district_code == 10860 & election == "2019 British general election"
replace district_name = "Northampton North" if district_code == 10861 & election == "2019 British general election"
replace district_name = "Northampton South" if district_code == 10862 & election == "2019 British general election"
replace district_name = "Norwich North" if district_code == 10863 & election == "2019 British general election"
replace district_name = "Norwich South" if district_code == 10864 & election == "2019 British general election"
replace district_name = "Nottingham East" if district_code == 10865 & election == "2019 British general election"
replace district_name = "Nottingham North" if district_code == 10866 & election == "2019 British general election"
replace district_name = "Nottingham South" if district_code == 10867 & election == "2019 British general election"
replace district_name = "Nuneaton" if district_code == 10868 & election == "2019 British general election"
replace district_name = "Old Bexley and Sidcup" if district_code == 10869 & election == "2019 British general election"
replace district_name = "Oldham East and Saddleworth" if district_code == 10870 & election == "2019 British general election"
replace district_name = "Oldham West and Royton" if district_code == 10871 & election == "2019 British general election"
replace district_name = "Orpington" if district_code == 10872 & election == "2019 British general election"
replace district_name = "Oxford East" if district_code == 10873 & election == "2019 British general election"
replace district_name = "Oxford West and Abingdon" if district_code == 10874 & election == "2019 British general election"
replace district_name = "Pendle" if district_code == 10875 & election == "2019 British general election"
replace district_name = "Penistone and Stocksbridge" if district_code == 10876 & election == "2019 British general election"
replace district_name = "Penrith and The Border" if district_code == 10877 & election == "2019 British general election"
replace district_name = "Peterborough" if district_code == 10878 & election == "2019 British general election"
replace district_name = "Plymouth, Moor View" if district_code == 10879 & election == "2019 British general election"
replace district_name = "Plymouth, Sutton and Devonport" if district_code == 10880 & election == "2019 British general election"
replace district_name = "Poole" if district_code == 10881 & election == "2019 British general election"
replace district_name = "Poplar and Limehouse" if district_code == 10882 & election == "2019 British general election"
replace district_name = "Portsmouth North" if district_code == 10883 & election == "2019 British general election"
replace district_name = "Portsmouth South" if district_code == 10884 & election == "2019 British general election"
replace district_name = "Preston" if district_code == 10885 & election == "2019 British general election"
replace district_name = "Pudsey" if district_code == 10886 & election == "2019 British general election"
replace district_name = "Putney" if district_code == 10887 & election == "2019 British general election"
replace district_name = "Rayleigh and Wickford" if district_code == 10888 & election == "2019 British general election"
replace district_name = "Reading East" if district_code == 10889 & election == "2019 British general election"
replace district_name = "Reading West" if district_code == 10890 & election == "2019 British general election"
replace district_name = "Redcar" if district_code == 10891 & election == "2019 British general election"
replace district_name = "Redditch" if district_code == 10892 & election == "2019 British general election"
replace district_name = "Reigate" if district_code == 10893 & election == "2019 British general election"
replace district_name = "Ribble Valley" if district_code == 10894 & election == "2019 British general election"
replace district_name = "Richmond (Yorks)" if district_code == 10895 & election == "2019 British general election"
replace district_name = "Richmond Park" if district_code == 10896 & election == "2019 British general election"
replace district_name = "Rochdale" if district_code == 10897 & election == "2019 British general election"
replace district_name = "Rochester and Strood" if district_code == 10898 & election == "2019 British general election"
replace district_name = "Rochford and Southend East" if district_code == 10899 & election == "2019 British general election"
replace district_name = "Romford" if district_code == 10900 & election == "2019 British general election"
replace district_name = "Romsey and Southampton North" if district_code == 10901 & election == "2019 British general election"
replace district_name = "Rossendale and Darwen" if district_code == 10902 & election == "2019 British general election"
replace district_name = "Rother Valley" if district_code == 10903 & election == "2019 British general election"
replace district_name = "Rotherham" if district_code == 10904 & election == "2019 British general election"
replace district_name = "Rugby" if district_code == 10905 & election == "2019 British general election"
replace district_name = "Ruislip, Northwood and Pinner" if district_code == 10906 & election == "2019 British general election"
replace district_name = "Runnymede and Weybridge" if district_code == 10907 & election == "2019 British general election"
replace district_name = "Rushcliffe" if district_code == 10908 & election == "2019 British general election"
replace district_name = "Rutland and Melton" if district_code == 10909 & election == "2019 British general election"
replace district_name = "Saffron Walden" if district_code == 10910 & election == "2019 British general election"
replace district_name = "Salford and Eccles" if district_code == 10911 & election == "2019 British general election"
replace district_name = "Salisbury" if district_code == 10912 & election == "2019 British general election"
replace district_name = "Scarborough and Whitby" if district_code == 10913 & election == "2019 British general election"
replace district_name = "Scunthorpe" if district_code == 10914 & election == "2019 British general election"
replace district_name = "Sedgefield" if district_code == 10915 & election == "2019 British general election"
replace district_name = "Sefton Central" if district_code == 10916 & election == "2019 British general election"
replace district_name = "Selby and Ainsty" if district_code == 10917 & election == "2019 British general election"
replace district_name = "Sevenoaks" if district_code == 10918 & election == "2019 British general election"
replace district_name = "Sheffield Central" if district_code == 10919 & election == "2019 British general election"
replace district_name = "Sheffield South East" if district_code == 10920 & election == "2019 British general election"
replace district_name = "Sheffield, Brightside and Hillsborough" if district_code == 10921 & election == "2019 British general election"
replace district_name = "Sheffield, Hallam" if district_code == 10922 & election == "2019 British general election"
replace district_name = "Sheffield, Heeley" if district_code == 10923 & election == "2019 British general election"
replace district_name = "Sherwood" if district_code == 10924 & election == "2019 British general election"
replace district_name = "Shipley" if district_code == 10925 & election == "2019 British general election"
replace district_name = "Shrewsbury and Atcham" if district_code == 10926 & election == "2019 British general election"
replace district_name = "Sittingbourne and Sheppey" if district_code == 10927 & election == "2019 British general election"
replace district_name = "Skipton and Ripon" if district_code == 10928 & election == "2019 British general election"
replace district_name = "Sleaford and North Hykeham" if district_code == 10929 & election == "2019 British general election"
replace district_name = "Slough" if district_code == 10930 & election == "2019 British general election"
replace district_name = "Solihull" if district_code == 10931 & election == "2019 British general election"
replace district_name = "Somerton and Frome" if district_code == 10932 & election == "2019 British general election"
replace district_name = "South Basildon and East Thurrock" if district_code == 10933 & election == "2019 British general election"
replace district_name = "South Cambridgeshire" if district_code == 10934 & election == "2019 British general election"
replace district_name = "South Derbyshire" if district_code == 10935 & election == "2019 British general election"
replace district_name = "South Dorset" if district_code == 10936 & election == "2019 British general election"
replace district_name = "South East Cambridgeshire" if district_code == 10937 & election == "2019 British general election"
replace district_name = "South East Cornwall" if district_code == 10938 & election == "2019 British general election"
replace district_name = "South Holland and The Deepings" if district_code == 10939 & election == "2019 British general election"
replace district_name = "South Leicestershire" if district_code == 10940 & election == "2019 British general election"
replace district_name = "South Norfolk" if district_code == 10941 & election == "2019 British general election"
replace district_name = "South Northamptonshire" if district_code == 10942 & election == "2019 British general election"
replace district_name = "South Ribble" if district_code == 10943 & election == "2019 British general election"
replace district_name = "South Shields" if district_code == 10944 & election == "2019 British general election"
replace district_name = "South Staffordshire" if district_code == 10945 & election == "2019 British general election"
replace district_name = "South Suffolk" if district_code == 10946 & election == "2019 British general election"
replace district_name = "South Swindon" if district_code == 10947 & election == "2019 British general election"
replace district_name = "South Thanet" if district_code == 10948 & election == "2019 British general election"
replace district_name = "South West Bedfordshire" if district_code == 10949 & election == "2019 British general election"
replace district_name = "South West Devon" if district_code == 10950 & election == "2019 British general election"
replace district_name = "South West Hertfordshire" if district_code == 10951 & election == "2019 British general election"
replace district_name = "South West Norfolk" if district_code == 10952 & election == "2019 British general election"
replace district_name = "South West Surrey" if district_code == 10953 & election == "2019 British general election"
replace district_name = "South West Wiltshire" if district_code == 10954 & election == "2019 British general election"
replace district_name = "Southampton, Itchen" if district_code == 10955 & election == "2019 British general election"
replace district_name = "Southampton, Test" if district_code == 10956 & election == "2019 British general election"
replace district_name = "Southend West" if district_code == 10957 & election == "2019 British general election"
replace district_name = "Southport" if district_code == 10958 & election == "2019 British general election"
replace district_name = "Spelthorne" if district_code == 10959 & election == "2019 British general election"
replace district_name = "St Albans" if district_code == 10960 & election == "2019 British general election"
replace district_name = "St Austell and Newquay" if district_code == 10961 & election == "2019 British general election"
replace district_name = "St Helens North" if district_code == 10962 & election == "2019 British general election"
replace district_name = "St Helens South and Whiston" if district_code == 10963 & election == "2019 British general election"
replace district_name = "St Ives" if district_code == 10964 & election == "2019 British general election"
replace district_name = "Stafford" if district_code == 10965 & election == "2019 British general election"
replace district_name = "Staffordshire Moorlands" if district_code == 10966 & election == "2019 British general election"
replace district_name = "Stalybridge and Hyde" if district_code == 10967 & election == "2019 British general election"
replace district_name = "Stevenage" if district_code == 10968 & election == "2019 British general election"
replace district_name = "Stockport" if district_code == 10969 & election == "2019 British general election"
replace district_name = "Stockton North" if district_code == 10970 & election == "2019 British general election"
replace district_name = "Stockton South" if district_code == 10971 & election == "2019 British general election"
replace district_name = "Stoke-On-Trent Central" if district_code == 10972 & election == "2019 British general election"
replace district_name = "Stoke-On-Trent North" if district_code == 10973 & election == "2019 British general election"
replace district_name = "Stoke-On-Trent South" if district_code == 10974 & election == "2019 British general election"
replace district_name = "Stone" if district_code == 10975 & election == "2019 British general election"
replace district_name = "Stourbridge" if district_code == 10976 & election == "2019 British general election"
replace district_name = "Stratford-On-Avon" if district_code == 10977 & election == "2019 British general election"
replace district_name = "Streatham" if district_code == 10978 & election == "2019 British general election"
replace district_name = "Stretford and Urmston" if district_code == 10979 & election == "2019 British general election"
replace district_name = "Stroud" if district_code == 10980 & election == "2019 British general election"
replace district_name = "Suffolk Coastal" if district_code == 10981 & election == "2019 British general election"
replace district_name = "Sunderland Central" if district_code == 10982 & election == "2019 British general election"
replace district_name = "Surrey Heath" if district_code == 10983 & election == "2019 British general election"
replace district_name = "Sutton and Cheam" if district_code == 10984 & election == "2019 British general election"
replace district_name = "Sutton Coldfield" if district_code == 10985 & election == "2019 British general election"
replace district_name = "Tamworth" if district_code == 10986 & election == "2019 British general election"
replace district_name = "Tatton" if district_code == 10987 & election == "2019 British general election"
replace district_name = "Taunton Deane" if district_code == 10988 & election == "2019 British general election"
replace district_name = "Telford" if district_code == 10989 & election == "2019 British general election"
replace district_name = "Tewkesbury" if district_code == 10990 & election == "2019 British general election"
replace district_name = "The Cotswolds" if district_code == 10991 & election == "2019 British general election"
replace district_name = "The Wrekin" if district_code == 10992 & election == "2019 British general election"
replace district_name = "Thirsk and Malton" if district_code == 10993 & election == "2019 British general election"
replace district_name = "Thornbury and Yate" if district_code == 10994 & election == "2019 British general election"
replace district_name = "Thurrock" if district_code == 10995 & election == "2019 British general election"
replace district_name = "Tiverton and Honiton" if district_code == 10996 & election == "2019 British general election"
replace district_name = "Tonbridge and Malling" if district_code == 10997 & election == "2019 British general election"
replace district_name = "Tooting" if district_code == 10998 & election == "2019 British general election"
replace district_name = "Torbay" if district_code == 10999 & election == "2019 British general election"
replace district_name = "Torridge and West Devon" if district_code == 11000 & election == "2019 British general election"
replace district_name = "Totnes" if district_code == 11001 & election == "2019 British general election"
replace district_name = "Tottenham" if district_code == 11002 & election == "2019 British general election"
replace district_name = "Truro and Falmouth" if district_code == 11003 & election == "2019 British general election"
replace district_name = "Tunbridge Wells" if district_code == 11004 & election == "2019 British general election"
replace district_name = "Twickenham" if district_code == 11005 & election == "2019 British general election"
replace district_name = "Tynemouth" if district_code == 11006 & election == "2019 British general election"
replace district_name = "Uxbridge and South Ruislip" if district_code == 11007 & election == "2019 British general election"
replace district_name = "Vauxhall" if district_code == 11008 & election == "2019 British general election"
replace district_name = "Wakefield" if district_code == 11009 & election == "2019 British general election"
replace district_name = "Wallasey" if district_code == 11010 & election == "2019 British general election"
replace district_name = "Walsall North" if district_code == 11011 & election == "2019 British general election"
replace district_name = "Walsall South" if district_code == 11012 & election == "2019 British general election"
replace district_name = "Walthamstow" if district_code == 11013 & election == "2019 British general election"
replace district_name = "Wansbeck" if district_code == 11014 & election == "2019 British general election"
replace district_name = "Wantage" if district_code == 11015 & election == "2019 British general election"
replace district_name = "Warley" if district_code == 11016 & election == "2019 British general election"
replace district_name = "Warrington North" if district_code == 11017 & election == "2019 British general election"
replace district_name = "Warrington South" if district_code == 11018 & election == "2019 British general election"
replace district_name = "Warwick and Leamington" if district_code == 11019 & election == "2019 British general election"
replace district_name = "Washington and Sunderland West" if district_code == 11020 & election == "2019 British general election"
replace district_name = "Watford" if district_code == 11021 & election == "2019 British general election"
replace district_name = "Waveney" if district_code == 11022 & election == "2019 British general election"
replace district_name = "Wealden" if district_code == 11023 & election == "2019 British general election"
replace district_name = "Weaver Vale" if district_code == 11024 & election == "2019 British general election"
replace district_name = "Wellingborough" if district_code == 11025 & election == "2019 British general election"
replace district_name = "Wells" if district_code == 11026 & election == "2019 British general election"
replace district_name = "Welwyn Hatfield" if district_code == 11027 & election == "2019 British general election"
replace district_name = "Wentworth and Dearne" if district_code == 11028 & election == "2019 British general election"
replace district_name = "West Bromwich East" if district_code == 11029 & election == "2019 British general election"
replace district_name = "West Bromwich West" if district_code == 11030 & election == "2019 British general election"
replace district_name = "West Dorset" if district_code == 11031 & election == "2019 British general election"
replace district_name = "West Ham" if district_code == 11032 & election == "2019 British general election"
replace district_name = "West Lancashire" if district_code == 11033 & election == "2019 British general election"
replace district_name = "West Suffolk" if district_code == 11034 & election == "2019 British general election"
replace district_name = "West Worcestershire" if district_code == 11035 & election == "2019 British general election"
replace district_name = "Westminster North" if district_code == 11036 & election == "2019 British general election"
replace district_name = "Westmorland and Lonsdale" if district_code == 11037 & election == "2019 British general election"
replace district_name = "Weston-Super-Mare" if district_code == 11038 & election == "2019 British general election"
replace district_name = "Wigan" if district_code == 11039 & election == "2019 British general election"
replace district_name = "Wimbledon" if district_code == 11040 & election == "2019 British general election"
replace district_name = "Winchester" if district_code == 11041 & election == "2019 British general election"
replace district_name = "Windsor" if district_code == 11042 & election == "2019 British general election"
replace district_name = "Wirral South" if district_code == 11043 & election == "2019 British general election"
replace district_name = "Wirral West" if district_code == 11044 & election == "2019 British general election"
replace district_name = "Witham" if district_code == 11045 & election == "2019 British general election"
replace district_name = "Witney" if district_code == 11046 & election == "2019 British general election"
replace district_name = "Woking" if district_code == 11047 & election == "2019 British general election"
replace district_name = "Wokingham" if district_code == 11048 & election == "2019 British general election"
replace district_name = "Wolverhampton North East" if district_code == 11049 & election == "2019 British general election"
replace district_name = "Wolverhampton South East" if district_code == 11050 & election == "2019 British general election"
replace district_name = "Wolverhampton South West" if district_code == 11051 & election == "2019 British general election"
replace district_name = "Worcester" if district_code == 11052 & election == "2019 British general election"
replace district_name = "Workington" if district_code == 11053 & election == "2019 British general election"
replace district_name = "Worsley and Eccles South" if district_code == 11054 & election == "2019 British general election"
replace district_name = "Worthing West" if district_code == 11055 & election == "2019 British general election"
replace district_name = "Wycombe" if district_code == 11056 & election == "2019 British general election"
replace district_name = "Wyre and Preston North" if district_code == 11057 & election == "2019 British general election"
replace district_name = "Wyre Forest" if district_code == 11058 & election == "2019 British general election"
replace district_name = "Wythenshawe and Sale East" if district_code == 11059 & election == "2019 British general election"
replace district_name = "Yeovil" if district_code == 11060 & election == "2019 British general election"
replace district_name = "York Central" if district_code == 11061 & election == "2019 British general election"
replace district_name = "York Outer" if district_code == 11062 & election == "2019 British general election"
replace district_name = "Belfast East" if district_code == 40001 & election == "2019 British general election"
replace district_name = "Belfast North" if district_code == 40002 & election == "2019 British general election"
replace district_name = "Belfast South" if district_code == 40003 & election == "2019 British general election"
replace district_name = "Belfast West" if district_code == 40004 & election == "2019 British general election"
replace district_name = "East Antrim" if district_code == 40005 & election == "2019 British general election"
replace district_name = "East Londonderry" if district_code == 40006 & election == "2019 British general election"
replace district_name = "Fermanagh and South Tyrone" if district_code == 40007 & election == "2019 British general election"
replace district_name = "Foyle" if district_code == 40008 & election == "2019 British general election"
replace district_name = "Lagan Valley" if district_code == 40009 & election == "2019 British general election"
replace district_name = "Mid Ulster" if district_code == 40010 & election == "2019 British general election"
replace district_name = "Newry and Armagh" if district_code == 40011 & election == "2019 British general election"
replace district_name = "North Antrim" if district_code == 40012 & election == "2019 British general election"
replace district_name = "North Down" if district_code == 40013 & election == "2019 British general election"
replace district_name = "South Antrim" if district_code == 40014 & election == "2019 British general election"
replace district_name = "South Down" if district_code == 40015 & election == "2019 British general election"
replace district_name = "Strangford" if district_code == 40016 & election == "2019 British general election"
replace district_name = "Upper Bann" if district_code == 40017 & election == "2019 British general election"
replace district_name = "West Tyrone" if district_code == 40018 & election == "2019 British general election"
replace district_name = "Aberdeen North" if district_code == 20001 & election == "2019 British general election"
replace district_name = "Aberdeen South" if district_code == 20002 & election == "2019 British general election"
replace district_name = "Airdrie and Shotts" if district_code == 20003 & election == "2019 British general election"
replace district_name = "Angus" if district_code == 20004 & election == "2019 British general election"
replace district_name = "Argyll and Bute" if district_code == 20005 & election == "2019 British general election"
replace district_name = "Ayr, Carrick and Cumnock" if district_code == 20006 & election == "2019 British general election"
replace district_name = "Banff and Buchan" if district_code == 20007 & election == "2019 British general election"
replace district_name = "Berwickshire, Roxburgh and Selkirk" if district_code == 20008 & election == "2019 British general election"
replace district_name = "Caithness, Sutherland and Easter Ross" if district_code == 20009 & election == "2019 British general election"
replace district_name = "Central Ayrshire" if district_code == 20010 & election == "2019 British general election"
replace district_name = "Coatbridge, Chryston and Bellshill" if district_code == 20011 & election == "2019 British general election"
replace district_name = "Cumbernauld, Kilsyth and Kirkintilloch East" if district_code == 20012 & election == "2019 British general election"
replace district_name = "Dumfries and Galloway" if district_code == 20013 & election == "2019 British general election"
replace district_name = "Dumfriesshire, Clydesdale and Tweeddale" if district_code == 20014 & election == "2019 British general election"
replace district_name = "Dundee East" if district_code == 20015 & election == "2019 British general election"
replace district_name = "Dundee West" if district_code == 20016 & election == "2019 British general election"
replace district_name = "Dunfermline and West Fife" if district_code == 20017 & election == "2019 British general election"
replace district_name = "East Dunbartonshire" if district_code == 20018 & election == "2019 British general election"
replace district_name = "East Kilbride, Strathaven and Lesmahagow" if district_code == 20019 & election == "2019 British general election"
replace district_name = "East Lothian" if district_code == 20020 & election == "2019 British general election"
replace district_name = "East Renfrewshire" if district_code == 20021 & election == "2019 British general election"
replace district_name = "Edinburgh East" if district_code == 20022 & election == "2019 British general election"
replace district_name = "Edinburgh North and Leith" if district_code == 20023 & election == "2019 British general election"
replace district_name = "Edinburgh South" if district_code == 20024 & election == "2019 British general election"
replace district_name = "Edinburgh South West" if district_code == 20025 & election == "2019 British general election"
replace district_name = "Edinburgh West" if district_code == 20026 & election == "2019 British general election"
replace district_name = "Na h-Eileanan An Iar" if district_code == 20027 & election == "2019 British general election"
replace district_name = "Falkirk" if district_code == 20028 & election == "2019 British general election"
replace district_name = "Glasgow Central" if district_code == 20029 & election == "2019 British general election"
replace district_name = "Glasgow East" if district_code == 20030 & election == "2019 British general election"
replace district_name = "Glasgow North" if district_code == 20031 & election == "2019 British general election"
replace district_name = "Glasgow North East" if district_code == 20032 & election == "2019 British general election"
replace district_name = "Glasgow North West" if district_code == 20033 & election == "2019 British general election"
replace district_name = "Glasgow South" if district_code == 20034 & election == "2019 British general election"
replace district_name = "Glasgow South West" if district_code == 20035 & election == "2019 British general election"
replace district_name = "Glenrothes" if district_code == 20036 & election == "2019 British general election"
replace district_name = "Gordon" if district_code == 20037 & election == "2019 British general election"
replace district_name = "Inverclyde" if district_code == 20038 & election == "2019 British general election"
replace district_name = "Inverness, Nairn, Badenoch and Strathspey" if district_code == 20039 & election == "2019 British general election"
replace district_name = "Kilmarnock and Loudoun" if district_code == 20040 & election == "2019 British general election"
replace district_name = "Kirkcaldy and Cowdenbeath" if district_code == 20041 & election == "2019 British general election"
replace district_name = "Lanark and Hamilton East" if district_code == 20042 & election == "2019 British general election"
replace district_name = "Linlithgow and East Falkirk" if district_code == 20043 & election == "2019 British general election"
replace district_name = "Livingston" if district_code == 20044 & election == "2019 British general election"
replace district_name = "Midlothian" if district_code == 20045 & election == "2019 British general election"
replace district_name = "Moray" if district_code == 20046 & election == "2019 British general election"
replace district_name = "Motherwell and Wishaw" if district_code == 20047 & election == "2019 British general election"
replace district_name = "North Ayrshire and Arran" if district_code == 20048 & election == "2019 British general election"
replace district_name = "North East Fife" if district_code == 20049 & election == "2019 British general election"
replace district_name = "Ochil and South Perthshire" if district_code == 20050 & election == "2019 British general election"
replace district_name = "Orkney and Shetland" if district_code == 20051 & election == "2019 British general election"
replace district_name = "Paisley and Renfrewshire North" if district_code == 20052 & election == "2019 British general election"
replace district_name = "Paisley and Renfrewshire South" if district_code == 20053 & election == "2019 British general election"
replace district_name = "Perth and North Perthshire" if district_code == 20054 & election == "2019 British general election"
replace district_name = "Ross, Skye and Lochaber" if district_code == 20055 & election == "2019 British general election"
replace district_name = "Rutherglen and Hamilton West" if district_code == 20056 & election == "2019 British general election"
replace district_name = "Stirling" if district_code == 20057 & election == "2019 British general election"
replace district_name = "West Aberdeenshire and Kincardine" if district_code == 20058 & election == "2019 British general election"
replace district_name = "West Dunbartonshire" if district_code == 20059 & election == "2019 British general election"
replace district_name = "Ynys Mon" if district_code == 30041 & election == "2019 British general election"
replace district_name = "Delyn" if district_code == 30042 & election == "2019 British general election"
replace district_name = "Alyn and Deeside" if district_code == 30043 & election == "2019 British general election"
replace district_name = "Wrexham" if district_code == 30044 & election == "2019 British general election"
replace district_name = "Llanelli" if district_code == 30045 & election == "2019 British general election"
replace district_name = "Gower" if district_code == 30046 & election == "2019 British general election"
replace district_name = "Swansea West" if district_code == 30047 & election == "2019 British general election"
replace district_name = "Swansea East" if district_code == 30048 & election == "2019 British general election"
replace district_name = "Aberavon" if district_code == 30049 & election == "2019 British general election"
replace district_name = "Cardiff Central" if district_code == 30050 & election == "2019 British general election"
replace district_name = "Cardiff North" if district_code == 30051 & election == "2019 British general election"
replace district_name = "Rhondda" if district_code == 30052 & election == "2019 British general election"
replace district_name = "Torfaen" if district_code == 30053 & election == "2019 British general election"
replace district_name = "Monmouth" if district_code == 30054 & election == "2019 British general election"
replace district_name = "Newport East" if district_code == 30055 & election == "2019 British general election"
replace district_name = "Newport West" if district_code == 30056 & election == "2019 British general election"
replace district_name = "Arfon" if district_code == 30057 & election == "2019 British general election"
replace district_name = "Aberconwy" if district_code == 30058 & election == "2019 British general election"
replace district_name = "Clwyd West" if district_code == 30059 & election == "2019 British general election"
replace district_name = "Vale Of Clwyd" if district_code == 30060 & election == "2019 British general election"
replace district_name = "Dwyfor Meirionnydd" if district_code == 30061 & election == "2019 British general election"
replace district_name = "Clwyd South" if district_code == 30062 & election == "2019 British general election"
replace district_name = "Montgomeryshire" if district_code == 30063 & election == "2019 British general election"
replace district_name = "Ceredigion" if district_code == 30064 & election == "2019 British general election"
replace district_name = "Preseli Pembrokeshire" if district_code == 30065 & election == "2019 British general election"
replace district_name = "Carmarthen West and South Pembrokeshire" if district_code == 30066 & election == "2019 British general election"
replace district_name = "Carmarthen East and Dinefwr" if district_code == 30067 & election == "2019 British general election"
replace district_name = "Brecon and Radnorshire" if district_code == 30068 & election == "2019 British general election"
replace district_name = "Neath" if district_code == 30069 & election == "2019 British general election"
replace district_name = "Cynon Valley" if district_code == 30070 & election == "2019 British general election"
replace district_name = "Merthyr Tydfil and Rhymney" if district_code == 30071 & election == "2019 British general election"
replace district_name = "Blaenau Gwent" if district_code == 30072 & election == "2019 British general election"
replace district_name = "Bridgend" if district_code == 30073 & election == "2019 British general election"
replace district_name = "Ogmore" if district_code == 30074 & election == "2019 British general election"
replace district_name = "Pontypridd" if district_code == 30075 & election == "2019 British general election"
replace district_name = "Caerphilly" if district_code == 30076 & election == "2019 British general election"
replace district_name = "Islwyn" if district_code == 30077 & election == "2019 British general election"
replace district_name = "Vale Of Glamorgan" if district_code == 30078 & election == "2019 British general election"
replace district_name = "Cardiff West" if district_code == 30079 & election == "2019 British general election"
replace district_name = "Cardiff South and Penarth" if district_code == 30080 & election == "2019 British general election"
replace district_name = "ABERAVON" if district_code == 1 & election == "1964 British general election"
replace district_name = "ABERDARE" if district_code == 2 & election == "1964 British general election"
replace district_name = "ABERDEEN NORTH" if district_code == 3 & election == "1964 British general election"
replace district_name = "ABERDEEN SOUTH" if district_code == 4 & election == "1964 British general election"
replace district_name = "EAST ABERDEENSHIRE" if district_code == 5 & election == "1964 British general election"
replace district_name = "WEST ABERDEENSHIRE" if district_code == 6 & election == "1964 British general election"
replace district_name = "ABERTILLERY" if district_code == 7 & election == "1964 British general election"
replace district_name = "ABINGDON" if district_code == 8 & election == "1964 British general election"
replace district_name = "ACCRINGTON" if district_code == 9 & election == "1964 British general election"
replace district_name = "ACTON" if district_code == 10 & election == "1964 British general election"
replace district_name = "ALDERSHOT" if district_code == 11 & election == "1964 British general election"
replace district_name = "ALTRINCHAM AND SALE" if district_code == 12 & election == "1964 British general election"
replace district_name = "ANGLESEY" if district_code == 13 & election == "1964 British general election"
replace district_name = "NORTH ANGUS AND MEARNS" if district_code == 14 & election == "1964 British general election"
replace district_name = "SOUTH ANGUS" if district_code == 15 & election == "1964 British general election"
replace district_name = "ANTRIM NORTH" if district_code == 16 & election == "1964 British general election"
replace district_name = "ANTRIM SOUTH" if district_code == 17 & election == "1964 British general election"
replace district_name = "ARGYLL" if district_code == 18 & election == "1964 British general election"
replace district_name = "ARMAGH" if district_code == 19 & election == "1964 British general election"
replace district_name = "ARUNDEL AND SHOREHAM" if district_code == 20 & election == "1964 British general election"
replace district_name = "ASHFIELD" if district_code == 21 & election == "1964 British general election"
replace district_name = "ASHFORD" if district_code == 22 & election == "1964 British general election"
replace district_name = "ASHTON UNDER LYNE" if district_code == 23 & election == "1964 British general election"
replace district_name = "AYLESBURY" if district_code == 24 & election == "1964 British general election"
replace district_name = "AYR" if district_code == 25 & election == "1964 British general election"
replace district_name = "CENTRAL AYRSHIRE" if district_code == 26 & election == "1964 British general election"
replace district_name = "BUTE AND NORTH AYRSHIRE" if district_code == 27 & election == "1964 British general election"
replace district_name = "SOUTH AYRSHIRE" if district_code == 28 & election == "1964 British general election"
replace district_name = "BANBURY" if district_code == 29 & election == "1964 British general election"
replace district_name = "BANFF" if district_code == 30 & election == "1964 British general election"
replace district_name = "BARKING" if district_code == 31 & election == "1964 British general election"
replace district_name = "BARKSTON ASH" if district_code == 32 & election == "1964 British general election"
replace district_name = "BARNET" if district_code == 33 & election == "1964 British general election"
replace district_name = "BARNSLEY" if district_code == 34 & election == "1964 British general election"
replace district_name = "BARONS COURT" if district_code == 35 & election == "1964 British general election"
replace district_name = "BARROW IN FURNESS" if district_code == 36 & election == "1964 British general election"
replace district_name = "BARRY" if district_code == 37 & election == "1964 British general election"
replace district_name = "BASINGSTOKE" if district_code == 38 & election == "1964 British general election"
replace district_name = "BASSETLAW" if district_code == 39 & election == "1964 British general election"
replace district_name = "BATH" if district_code == 40 & election == "1964 British general election"
replace district_name = "BATLEY AND MORLEY" if district_code == 41 & election == "1964 British general election"
replace district_name = "BATTERSEA,NORTH" if district_code == 42 & election == "1964 British general election"
replace district_name = "BATTERSEA,SOUTH" if district_code == 43 & election == "1964 British general election"
replace district_name = "BEBINGTON" if district_code == 44 & election == "1964 British general election"
replace district_name = "BECKENHAM" if district_code == 45 & election == "1964 British general election"
replace district_name = "BEDFORD" if district_code == 46 & election == "1964 British general election"
replace district_name = "MID-BEDFORDSHIRE" if district_code == 47 & election == "1964 British general election"
replace district_name = "SOUTH BEDFORDSHIRE" if district_code == 48 & election == "1964 British general election"
replace district_name = "BEDWELLTY" if district_code == 49 & election == "1964 British general election"
replace district_name = "BELFAST EAST" if district_code == 50 & election == "1964 British general election"
replace district_name = "BELFAST NORTH" if district_code == 51 & election == "1964 British general election"
replace district_name = "BELFAST SOUTH" if district_code == 52 & election == "1964 British general election"
replace district_name = "BELFAST WEST" if district_code == 53 & election == "1964 British general election"
replace district_name = "BELPER" if district_code == 54 & election == "1964 British general election"
replace district_name = "BERMONDSEY" if district_code == 55 & election == "1964 British general election"
replace district_name = "BERWICK AND EAST LOTHIAN" if district_code == 56 & election == "1964 British general election"
replace district_name = "BERWICK UPON TWEED" if district_code == 57 & election == "1964 British general election"
replace district_name = "BETHNAL GREEN" if district_code == 58 & election == "1964 British general election"
replace district_name = "BEXLEY" if district_code == 59 & election == "1964 British general election"
replace district_name = "BILLERICAY" if district_code == 60 & election == "1964 British general election"
replace district_name = "BILSTON" if district_code == 61 & election == "1964 British general election"
replace district_name = "BIRKENHEAD" if district_code == 62 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,ALL SAINTS" if district_code == 63 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,ASTON" if district_code == 64 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,EDGBASTON" if district_code == 65 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,HALL GREEN" if district_code == 66 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,HANDSWORTH" if district_code == 67 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,LADYWOOD" if district_code == 68 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,NORTHFIED" if district_code == 69 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,PERRY BARR" if district_code == 70 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,SELLY OAK" if district_code == 71 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,SMALL HEATH" if district_code == 72 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,SPARKBROOK" if district_code == 73 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,STECHFORD" if district_code == 74 & election == "1964 British general election"
replace district_name = "BIRMINGHAM,YARDLEY" if district_code == 75 & election == "1964 British general election"
replace district_name = "BISHOP AUCKLAND" if district_code == 76 & election == "1964 British general election"
replace district_name = "BLACKBURN" if district_code == 77 & election == "1964 British general election"
replace district_name = "BLACKPOOL,NORTH" if district_code == 78 & election == "1964 British general election"
replace district_name = "BLACKPOOL,SOUTH" if district_code == 79 & election == "1964 British general election"
replace district_name = "BLAYDON" if district_code == 80 & election == "1964 British general election"
replace district_name = "BLYTH" if district_code == 81 & election == "1964 British general election"
replace district_name = "BODMIN" if district_code == 82 & election == "1964 British general election"
replace district_name = "BOLSOVER" if district_code == 83 & election == "1964 British general election"
replace district_name = "BOLTON,EAST" if district_code == 84 & election == "1964 British general election"
replace district_name = "BOLTON,WEST" if district_code == 85 & election == "1964 British general election"
replace district_name = "BOOTLE" if district_code == 86 & election == "1964 British general election"
replace district_name = "BOSWORTH" if district_code == 87 & election == "1964 British general election"
replace district_name = "BOTHWELL" if district_code == 88 & election == "1964 British general election"
replace district_name = "BOURNEMOUTH EAST AND CHRISTCHURCH" if district_code == 89 & election == "1964 British general election"
replace district_name = "BOURNEMOUTH WEST" if district_code == 90 & election == "1964 British general election"
replace district_name = "BRADFORD,EAST" if district_code == 91 & election == "1964 British general election"
replace district_name = "BRADFORD,NORTH" if district_code == 92 & election == "1964 British general election"
replace district_name = "BRADFORD,SOUTH" if district_code == 93 & election == "1964 British general election"
replace district_name = "BRADFORD,WEST" if district_code == 94 & election == "1964 British general election"
replace district_name = "BRECON AND RADNOR" if district_code == 95 & election == "1964 British general election"
replace district_name = "BRENTFORD AND CHISWICK" if district_code == 96 & election == "1964 British general election"
replace district_name = "BRIDGWATER" if district_code == 97 & election == "1964 British general election"
replace district_name = "BRIDLINGTON" if district_code == 98 & election == "1964 British general election"
replace district_name = "BRIERLEY HILL" if district_code == 99 & election == "1964 British general election"
replace district_name = "BRIGG" if district_code == 100 & election == "1964 British general election"
replace district_name = "BRIGHOUSE AND SPENBOROUGH" if district_code == 101 & election == "1964 British general election"
replace district_name = "BRIGHTON,KEMPTOWN" if district_code == 102 & election == "1964 British general election"
replace district_name = "BRIGHTON,PAVILION" if district_code == 103 & election == "1964 British general election"
replace district_name = "BRISTOL,CENTRAL" if district_code == 104 & election == "1964 British general election"
replace district_name = "BRISTOL,NORTH EAST" if district_code == 105 & election == "1964 British general election"
replace district_name = "BRISTOL,NORTH WEST" if district_code == 106 & election == "1964 British general election"
replace district_name = "BRISTOL,SOUTH" if district_code == 107 & election == "1964 British general election"
replace district_name = "BRISTOL,SOUTH EAST" if district_code == 108 & election == "1964 British general election"
replace district_name = "BRISTOL,WEST" if district_code == 109 & election == "1964 British general election"
replace district_name = "BROMLEY" if district_code == 110 & election == "1964 British general election"
replace district_name = "BROMSGROVE" if district_code == 111 & election == "1964 British general election"
replace district_name = "BUCKINGHAM" if district_code == 112 & election == "1964 British general election"
replace district_name = "SOUTH BUCKINGHAMSHIRE" if district_code == 113 & election == "1964 British general election"
replace district_name = "BURNLEY" if district_code == 114 & election == "1964 British general election"
replace district_name = "BURTON" if district_code == 115 & election == "1964 British general election"
replace district_name = "BURY AND RADCLIFFE" if district_code == 116 & election == "1964 British general election"
replace district_name = "BURY ST.EDMUNDS" if district_code == 117 & election == "1964 British general election"
replace district_name = "CAERNARVON" if district_code == 118 & election == "1964 British general election"
replace district_name = "CAERPHILLY" if district_code == 119 & election == "1964 British general election"
replace district_name = "CAITHNESS AND SUTHERLAND" if district_code == 120 & election == "1964 British general election"
replace district_name = "CAMBERWELL,DULWICH" if district_code == 121 & election == "1964 British general election"
replace district_name = "CAMBERWELL,PECKHAM" if district_code == 122 & election == "1964 British general election"
replace district_name = "CAMBRIDGE" if district_code == 123 & election == "1964 British general election"
replace district_name = "CAMBRIDGESHIRE" if district_code == 124 & election == "1964 British general election"
replace district_name = "CANNOCK" if district_code == 125 & election == "1964 British general election"
replace district_name = "CANTERBURY" if district_code == 126 & election == "1964 British general election"
replace district_name = "CARDIFF,NORTH" if district_code == 127 & election == "1964 British general election"
replace district_name = "CARDIFF,SOUTH EAST" if district_code == 128 & election == "1964 British general election"
replace district_name = "CARDIFF,WEST" if district_code == 129 & election == "1964 British general election"
replace district_name = "CARDIGAN" if district_code == 130 & election == "1964 British general election"
replace district_name = "CARLISLE" if district_code == 131 & election == "1964 British general election"
replace district_name = "CARLTON" if district_code == 132 & election == "1964 British general election"
replace district_name = "CARMARTHEN" if district_code == 133 & election == "1964 British general election"
replace district_name = "CARSHALTON" if district_code == 134 & election == "1964 British general election"
replace district_name = "CHEADLE" if district_code == 135 & election == "1964 British general election"
replace district_name = "CHELMSFORD" if district_code == 136 & election == "1964 British general election"
replace district_name = "CHELSEA" if district_code == 137 & election == "1964 British general election"
replace district_name = "CHELTENHAM" if district_code == 138 & election == "1964 British general election"
replace district_name = "CHERTSEY" if district_code == 139 & election == "1964 British general election"
replace district_name = "CITY OF CHESTER" if district_code == 140 & election == "1964 British general election"
replace district_name = "CHESTERFIELD" if district_code == 141 & election == "1964 British general election"
replace district_name = "CHESTER-LE-STREET" if district_code == 142 & election == "1964 British general election"
replace district_name = "CHICHESTER" if district_code == 143 & election == "1964 British general election"
replace district_name = "CHIGWELL" if district_code == 144 & election == "1964 British general election"
replace district_name = "CHIPPENHAM" if district_code == 145 & election == "1964 British general election"
replace district_name = "CHISLEHURST" if district_code == 146 & election == "1964 British general election"
replace district_name = "CHORLEY" if district_code == 147 & election == "1964 British general election"
replace district_name = "CIRENCESTER AND TEWKESBURY" if district_code == 148 & election == "1964 British general election"
replace district_name = "CLEVELAND" if district_code == 149 & election == "1964 British general election"
replace district_name = "CLITHEROE" if district_code == 150 & election == "1964 British general election"
replace district_name = "COATBRIDGE AND AIRDRIE" if district_code == 151 & election == "1964 British general election"
replace district_name = "COLCHESTER" if district_code == 152 & election == "1964 British general election"
replace district_name = "COLNE VALLEY" if district_code == 153 & election == "1964 British general election"
replace district_name = "CONSETT" if district_code == 154 & election == "1964 British general election"
replace district_name = "CONWAY" if district_code == 155 & election == "1964 British general election"
replace district_name = "NORTH CORNWALL" if district_code == 156 & election == "1964 British general election"
replace district_name = "COVENTRY,EAST" if district_code == 157 & election == "1964 British general election"
replace district_name = "COVENTRY,NORTH" if district_code == 158 & election == "1964 British general election"
replace district_name = "COVENTRY,SOUTH" if district_code == 159 & election == "1964 British general election"
replace district_name = "CREWE" if district_code == 160 & election == "1964 British general election"
replace district_name = "CROSBY" if district_code == 161 & election == "1964 British general election"
replace district_name = "CROYDON,NORTH EAST" if district_code == 162 & election == "1964 British general election"
replace district_name = "CROYDON,NORTH WEST" if district_code == 163 & election == "1964 British general election"
replace district_name = "CROYDON,SOUTH" if district_code == 164 & election == "1964 British general election"
replace district_name = "DAGENHAM" if district_code == 165 & election == "1964 British general election"
replace district_name = "DARLINGTON" if district_code == 166 & election == "1964 British general election"
replace district_name = "DARTFORD" if district_code == 167 & election == "1964 British general election"
replace district_name = "DARWEN" if district_code == 168 & election == "1964 British general election"
replace district_name = "DEARNE VALLEY" if district_code == 169 & election == "1964 British general election"
replace district_name = "DENBIGH" if district_code == 170 & election == "1964 British general election"
replace district_name = "DEPTFORD" if district_code == 171 & election == "1964 British general election"
replace district_name = "DERBY NORTH" if district_code == 172 & election == "1964 British general election"
replace district_name = "DERBY SOUTH" if district_code == 173 & election == "1964 British general election"
replace district_name = "NORTH EAST DERBYSHIRE" if district_code == 174 & election == "1964 British general election"
replace district_name = "SOUTH EAST DERBYSHIRE" if district_code == 175 & election == "1964 British general election"
replace district_name = "WEST DERBYSHIRE" if district_code == 176 & election == "1964 British general election"
replace district_name = "DEVIZES" if district_code == 177 & election == "1964 British general election"
replace district_name = "NORTH DEVON" if district_code == 178 & election == "1964 British general election"
replace district_name = "DEWSBURY" if district_code == 179 & election == "1964 British general election"
replace district_name = "DONCASTER" if district_code == 180 & election == "1964 British general election"
replace district_name = "DON VALLEY" if district_code == 181 & election == "1964 British general election"
replace district_name = "DORKING" if district_code == 182 & election == "1964 British general election"
replace district_name = "NORTH DORSET" if district_code == 183 & election == "1964 British general election"
replace district_name = "SOUTH DORSET" if district_code == 184 & election == "1964 British general election"
replace district_name = "WEST DORSET" if district_code == 185 & election == "1964 British general election"
replace district_name = "DOVER" if district_code == 186 & election == "1964 British general election"
replace district_name = "DOWN NORTH" if district_code == 187 & election == "1964 British general election"
replace district_name = "DOWN SOUTH" if district_code == 188 & election == "1964 British general election"
replace district_name = "DUDLEY" if district_code == 189 & election == "1964 British general election"
replace district_name = "DUMFRIES" if district_code == 190 & election == "1964 British general election"
replace district_name = "EAST DUNBARTONSHIRE" if district_code == 191 & election == "1964 British general election"
replace district_name = "WEST DUNBARTONSHIRE" if district_code == 192 & election == "1964 British general election"
replace district_name = "DUNDEE EAST" if district_code == 193 & election == "1964 British general election"
replace district_name = "DUNDEE WEST" if district_code == 194 & election == "1964 British general election"
replace district_name = "DUNFERMLINE BURGHS" if district_code == 195 & election == "1964 British general election"
replace district_name = "DURHAM" if district_code == 196 & election == "1964 British general election"
replace district_name = "NORTH WEST DURHAM" if district_code == 197 & election == "1964 British general election"
replace district_name = "EALING,NORTH" if district_code == 198 & election == "1964 British general election"
replace district_name = "EALING,SOUTH" if district_code == 199 & election == "1964 British general election"
replace district_name = "EASINGTON" if district_code == 200 & election == "1964 British general election"
replace district_name = "EASTBOURNE" if district_code == 201 & election == "1964 British general election"
replace district_name = "EAST GRINSTEAD" if district_code == 202 & election == "1964 British general election"
replace district_name = "EAST HAM,NORTH" if district_code == 203 & election == "1964 British general election"
replace district_name = "EAST HAM,SOUTH" if district_code == 204 & election == "1964 British general election"
replace district_name = "EASTLEIGH" if district_code == 205 & election == "1964 British general election"
replace district_name = "EBBW VALE" if district_code == 206 & election == "1964 British general election"
replace district_name = "ECCLES" if district_code == 207 & election == "1964 British general election"
replace district_name = "EDINBURGH CENTRAL" if district_code == 208 & election == "1964 British general election"
replace district_name = "EDINBURGH EAST" if district_code == 209 & election == "1964 British general election"
replace district_name = "EDINBURGH LEITH" if district_code == 210 & election == "1964 British general election"
replace district_name = "EDINBURGH NORTH" if district_code == 211 & election == "1964 British general election"
replace district_name = "EDINBURGH PENTLANDS" if district_code == 212 & election == "1964 British general election"
replace district_name = "EDINBURGH SOUTH" if district_code == 213 & election == "1964 British general election"
replace district_name = "EDINBURGH WEST" if district_code == 214 & election == "1964 British general election"
replace district_name = "EDMONTON" if district_code == 215 & election == "1964 British general election"
replace district_name = "ENFIELD,EAST" if district_code == 216 & election == "1964 British general election"
replace district_name = "ENFIELD,WEST" if district_code == 217 & election == "1964 British general election"
replace district_name = "EPPING" if district_code == 218 & election == "1964 British general election"
replace district_name = "EPSOM" if district_code == 219 & election == "1964 British general election"
replace district_name = "ERITH AND CRAYFORD" if district_code == 220 & election == "1964 British general election"
replace district_name = "ESHER" if district_code == 221 & election == "1964 British general election"
replace district_name = "SOUTH EAST ESSEX" if district_code == 222 & election == "1964 British general election"
replace district_name = "ETON AND SLOUGH" if district_code == 223 & election == "1964 British general election"
replace district_name = "EXETER" if district_code == 224 & election == "1964 British general election"
replace district_name = "EYE" if district_code == 225 & election == "1964 British general election"
replace district_name = "FALMOUTH AND CAMBORNE" if district_code == 226 & election == "1964 British general election"
replace district_name = "FARNHAM" if district_code == 227 & election == "1964 British general election"
replace district_name = "FARNWORTH" if district_code == 228 & election == "1964 British general election"
replace district_name = "FAVERSHAM" if district_code == 229 & election == "1964 British general election"
replace district_name = "FELTHAM" if district_code == 230 & election == "1964 British general election"
replace district_name = "FERMANAGH AND SOUTH TYRONE" if district_code == 231 & election == "1964 British general election"
replace district_name = "EAST FIFE" if district_code == 232 & election == "1964 British general election"
replace district_name = "WEST FIFE" if district_code == 233 & election == "1964 British general election"
replace district_name = "FINCHLEY" if district_code == 234 & election == "1964 British general election"
replace district_name = "EAST FLINTSHIRE" if district_code == 235 & election == "1964 British general election"
replace district_name = "WEST FLINTSHIRE" if district_code == 236 & election == "1964 British general election"
replace district_name = "FOLKESTONE AND HYTHE" if district_code == 237 & election == "1964 British general election"
replace district_name = "FULHAM" if district_code == 238 & election == "1964 British general election"
replace district_name = "GAINSBOROUGH" if district_code == 239 & election == "1964 British general election"
replace district_name = "GALLOWAY" if district_code == 240 & election == "1964 British general election"
replace district_name = "GATESHEAD EAST" if district_code == 241 & election == "1964 British general election"
replace district_name = "GATESHEAD WEST" if district_code == 242 & election == "1964 British general election"
replace district_name = "GILLINGHAM" if district_code == 243 & election == "1964 British general election"
replace district_name = "GLASGOW BRIDGETON" if district_code == 244 & election == "1964 British general election"
replace district_name = "GLASGOW CATHCART" if district_code == 245 & election == "1964 British general election"
replace district_name = "GLASGOW CENTRAL" if district_code == 246 & election == "1964 British general election"
replace district_name = "GLASGOW CRAIGTON" if district_code == 247 & election == "1964 British general election"
replace district_name = "GLASGOW GORBALS" if district_code == 248 & election == "1964 British general election"
replace district_name = "GLASGOW GOVAN" if district_code == 249 & election == "1964 British general election"
replace district_name = "GLASGOW HILLHEAD" if district_code == 250 & election == "1964 British general election"
replace district_name = "GLASGOW KELVINGROVE" if district_code == 251 & election == "1964 British general election"
replace district_name = "GLASGOW MARYHILL" if district_code == 252 & election == "1964 British general election"
replace district_name = "GLASGOW POLLOK" if district_code == 253 & election == "1964 British general election"
replace district_name = "GLASGOW PROVAN" if district_code == 254 & election == "1964 British general election"
replace district_name = "GLASGOW SCOTSTOUN" if district_code == 255 & election == "1964 British general election"
replace district_name = "GLASGOW SHETTLESTON" if district_code == 256 & election == "1964 British general election"
replace district_name = "GLASGOW SPRINGBURN" if district_code == 257 & election == "1964 British general election"
replace district_name = "GLASGOW WOODSIDE" if district_code == 258 & election == "1964 British general election"
replace district_name = "GLOUCESTER" if district_code == 259 & election == "1964 British general election"
replace district_name = "SOUTH GLOUCESTERSHIRE" if district_code == 260 & election == "1964 British general election"
replace district_name = "WEST GLOUCESTERSHIRE" if district_code == 261 & election == "1964 British general election"
replace district_name = "GOOLE" if district_code == 262 & election == "1964 British general election"
replace district_name = "GOSPORT AND FAREHAM" if district_code == 263 & election == "1964 British general election"
replace district_name = "GOWER" if district_code == 264 & election == "1964 British general election"
replace district_name = "GRANTHAM" if district_code == 265 & election == "1964 British general election"
replace district_name = "GRAVESEND" if district_code == 266 & election == "1964 British general election"
replace district_name = "GREENOCK" if district_code == 267 & election == "1964 British general election"
replace district_name = "GREENWICH" if district_code == 268 & election == "1964 British general election"
replace district_name = "GRIMSBY" if district_code == 269 & election == "1964 British general election"
replace district_name = "GUILDFORD" if district_code == 270 & election == "1964 British general election"
replace district_name = "HACKNEY CENTRAL" if district_code == 271 & election == "1964 British general election"
replace district_name = "HALIFAX" if district_code == 272 & election == "1964 British general election"
replace district_name = "HALTEMPRICE" if district_code == 273 & election == "1964 British general election"
replace district_name = "HAMILTON" if district_code == 274 & election == "1964 British general election"
replace district_name = "HAMMERSMITH NORTH" if district_code == 275 & election == "1964 British general election"
replace district_name = "HAMPSTEAD" if district_code == 276 & election == "1964 British general election"
replace district_name = "HARBOROUGH" if district_code == 277 & election == "1964 British general election"
replace district_name = "HARROGATE" if district_code == 278 & election == "1964 British general election"
replace district_name = "HARROW,CENTRAL" if district_code == 279 & election == "1964 British general election"
replace district_name = "HARROW,EAST" if district_code == 280 & election == "1964 British general election"
replace district_name = "HARROW,WEST" if district_code == 281 & election == "1964 British general election"
replace district_name = "THE HARTLEPOOLS" if district_code == 282 & election == "1964 British general election"
replace district_name = "HARWICH" if district_code == 283 & election == "1964 British general election"
replace district_name = "HASTINGS" if district_code == 284 & election == "1964 British general election"
replace district_name = "HAYES AND HARLINGTON" if district_code == 285 & election == "1964 British general election"
replace district_name = "HEMEL HEMPSTEAD" if district_code == 286 & election == "1964 British general election"
replace district_name = "HEMSWORTH" if district_code == 287 & election == "1964 British general election"
replace district_name = "HENDON,NORTH" if district_code == 288 & election == "1964 British general election"
replace district_name = "HENDON,SOUTH" if district_code == 289 & election == "1964 British general election"
replace district_name = "HENLEY" if district_code == 290 & election == "1964 British general election"
replace district_name = "HEREFORD" if district_code == 291 & election == "1964 British general election"
replace district_name = "HERTFORD" if district_code == 292 & election == "1964 British general election"
replace district_name = "EAST HERTFORDSHIRE" if district_code == 293 & election == "1964 British general election"
replace district_name = "SOUTH WEST HERTFORDSHIRE" if district_code == 294 & election == "1964 British general election"
replace district_name = "HESTON AND ISLEWORTH" if district_code == 295 & election == "1964 British general election"
replace district_name = "HEXHAM" if district_code == 296 & election == "1964 British general election"
replace district_name = "HEYWOOD AND ROYTON" if district_code == 297 & election == "1964 British general election"
replace district_name = "HIGH PEAK" if district_code == 298 & election == "1964 British general election"
replace district_name = "HITCHIN" if district_code == 299 & election == "1964 British general election"
replace district_name = "HOLBORN AND ST.PANCRAS" if district_code == 300 & election == "1964 British general election"
replace district_name = "HOLLAND WITH BOSTON" if district_code == 301 & election == "1964 British general election"
replace district_name = "HONITON" if district_code == 302 & election == "1964 British general election"
replace district_name = "HORNCASTLE" if district_code == 303 & election == "1964 British general election"
replace district_name = "HORNCHURCH" if district_code == 304 & election == "1964 British general election"
replace district_name = "HORNSEY" if district_code == 305 & election == "1964 British general election"
replace district_name = "HORSHAM" if district_code == 306 & election == "1964 British general election"
replace district_name = "HOUGHTON-LE-SPRING" if district_code == 307 & election == "1964 British general election"
replace district_name = "HOVE" if district_code == 308 & election == "1964 British general election"
replace district_name = "HOWDEN" if district_code == 309 & election == "1964 British general election"
replace district_name = "HUDDERSFIELD,EAST" if district_code == 310 & election == "1964 British general election"
replace district_name = "HUDDERSFIELD,WEST" if district_code == 311 & election == "1964 British general election"
replace district_name = "HUNTINGDONSHIRE" if district_code == 312 & election == "1964 British general election"
replace district_name = "HUYTON" if district_code == 313 & election == "1964 British general election"
replace district_name = "ILFORD,NORTH" if district_code == 314 & election == "1964 British general election"
replace district_name = "ILFORD,SOUTH" if district_code == 315 & election == "1964 British general election"
replace district_name = "ILKESTON" if district_code == 316 & election == "1964 British general election"
replace district_name = "INCE" if district_code == 317 & election == "1964 British general election"
replace district_name = "INVERNESS" if district_code == 318 & election == "1964 British general election"
replace district_name = "IPSWICH" if district_code == 319 & election == "1964 British general election"
replace district_name = "THE ISLE OF ELY" if district_code == 320 & election == "1964 British general election"
replace district_name = "ISLE OF THANET" if district_code == 321 & election == "1964 British general election"
replace district_name = "ISLE OF WIGHT" if district_code == 322 & election == "1964 British general election"
replace district_name = "ISLINGTON,EAST" if district_code == 323 & election == "1964 British general election"
replace district_name = "ISLINGTON,NORTH" if district_code == 324 & election == "1964 British general election"
replace district_name = "ISLINGTON,SOUTH WEST" if district_code == 325 & election == "1964 British general election"
replace district_name = "JARROW" if district_code == 326 & election == "1964 British general election"
replace district_name = "KEIGHLEY" if district_code == 327 & election == "1964 British general election"
replace district_name = "KENSINGTON,NORTH" if district_code == 328 & election == "1964 British general election"
replace district_name = "KENSINGTON,SOUTH" if district_code == 329 & election == "1964 British general election"
replace district_name = "KETTERING" if district_code == 330 & election == "1964 British general election"
replace district_name = "KIDDERMINSTER" if district_code == 331 & election == "1964 British general election"
replace district_name = "KILMARNOCK" if district_code == 332 & election == "1964 British general election"
replace district_name = "KING'S LYNN" if district_code == 333 & election == "1964 British general election"
replace district_name = "KINGSTON-UPON-HULL EAST" if district_code == 334 & election == "1964 British general election"
replace district_name = "KINGSTON-UPON-HULL NORTH" if district_code == 335 & election == "1964 British general election"
replace district_name = "KINGSTON-UPON-HULL WEST" if district_code == 336 & election == "1964 British general election"
replace district_name = "KINGSTON UPON THAMES" if district_code == 337 & election == "1964 British general election"
replace district_name = "KINROSS AND WEST PERTHSHIRE" if district_code == 338 & election == "1964 British general election"
replace district_name = "KIRKCALDY BURGHS" if district_code == 339 & election == "1964 British general election"
replace district_name = "KNUTSFORD" if district_code == 340 & election == "1964 British general election"
replace district_name = "LAMBETH,BRIXTON" if district_code == 341 & election == "1964 British general election"
replace district_name = "LAMBETH,NORWOOD" if district_code == 342 & election == "1964 British general election"
replace district_name = "LAMBETH,VAUXHALL" if district_code == 343 & election == "1964 British general election"
replace district_name = "LANARK" if district_code == 344 & election == "1964 British general election"
replace district_name = "NORTH LANARKSHIRE" if district_code == 345 & election == "1964 British general election"
replace district_name = "LANCASTER" if district_code == 346 & election == "1964 British general election"
replace district_name = "LEEDS,EAST" if district_code == 347 & election == "1964 British general election"
replace district_name = "LEEDS,NORTH EAST" if district_code == 348 & election == "1964 British general election"
replace district_name = "LEEDS,NORTH WEST" if district_code == 349 & election == "1964 British general election"
replace district_name = "LEEDS,SOUTH" if district_code == 350 & election == "1964 British general election"
replace district_name = "LEEDS,SOUTH EAST" if district_code == 351 & election == "1964 British general election"
replace district_name = "LEEDS,WEST" if district_code == 352 & election == "1964 British general election"
replace district_name = "LEEK" if district_code == 353 & election == "1964 British general election"
replace district_name = "LEICESTER,NORTH EAST" if district_code == 354 & election == "1964 British general election"
replace district_name = "LEICESTER,NORTH WEST" if district_code == 355 & election == "1964 British general election"
replace district_name = "LEICESTER,SOUTH EAST" if district_code == 356 & election == "1964 British general election"
replace district_name = "LEICESTER,SOUTH WEST" if district_code == 357 & election == "1964 British general election"
replace district_name = "LEIGH" if district_code == 358 & election == "1964 British general election"
replace district_name = "LEOMINSTER" if district_code == 359 & election == "1964 British general election"
replace district_name = "LEWES" if district_code == 360 & election == "1964 British general election"
replace district_name = "LEWISHAM,NORTH" if district_code == 361 & election == "1964 British general election"
replace district_name = "LEWISHAM,SOUTH" if district_code == 362 & election == "1964 British general election"
replace district_name = "LEWISHAM,WEST" if district_code == 363 & election == "1964 British general election"
replace district_name = "LEYTON" if district_code == 364 & election == "1964 British general election"
replace district_name = "LICHFIELD AND TAMWORTH" if district_code == 365 & election == "1964 British general election"
replace district_name = "LINCOLN" if district_code == 366 & election == "1964 British general election"
replace district_name = "LIVERPOOL,EDGE HILL" if district_code == 367 & election == "1964 British general election"
replace district_name = "LIVERPOOL,EXCHANGE" if district_code == 368 & election == "1964 British general election"
replace district_name = "LIVERPOOL,GARSTON" if district_code == 369 & election == "1964 British general election"
replace district_name = "LIVERPOOL,KIRKDALE" if district_code == 370 & election == "1964 British general election"
replace district_name = "LIVERPOOL,SCOTLAND" if district_code == 371 & election == "1964 British general election"
replace district_name = "LIVERPOOL,TOXTETH" if district_code == 372 & election == "1964 British general election"
replace district_name = "LIVERPOOL,WALTON" if district_code == 373 & election == "1964 British general election"
replace district_name = "LIVERPOOL,WAVERTREE" if district_code == 374 & election == "1964 British general election"
replace district_name = "LIVERPOOL,WEST DERBY" if district_code == 375 & election == "1964 British general election"
replace district_name = "LLANELLI" if district_code == 376 & election == "1964 British general election"
replace district_name = "CITIES OF LONDON AND WESTMINSTER" if district_code == 377 & election == "1964 British general election"
replace district_name = "LONDONDERRY COUNTY" if district_code == 378 & election == "1964 British general election"
replace district_name = "LOUGHBOROUGH" if district_code == 379 & election == "1964 British general election"
replace district_name = "LOUTH" if district_code == 380 & election == "1964 British general election"
replace district_name = "LOWESTOFT" if district_code == 381 & election == "1964 British general election"
replace district_name = "LUDLOW" if district_code == 382 & election == "1964 British general election"
replace district_name = "LUTON" if district_code == 383 & election == "1964 British general election"
replace district_name = "MACCLESFIELD" if district_code == 384 & election == "1964 British general election"
replace district_name = "MAIDSTONE" if district_code == 385 & election == "1964 British general election"
replace district_name = "MALDON" if district_code == 386 & election == "1964 British general election"
replace district_name = "MANCHESTER,ARDWICK" if district_code == 387 & election == "1964 British general election"
replace district_name = "MANCHESTER,BLACKLEY" if district_code == 388 & election == "1964 British general election"
replace district_name = "MANCHESTER,CHEETHAM" if district_code == 389 & election == "1964 British general election"
replace district_name = "MANCHESTER,EXCHANGE" if district_code == 390 & election == "1964 British general election"
replace district_name = "MANCHESTER,GORTON" if district_code == 391 & election == "1964 British general election"
replace district_name = "MANCHESTER,MOSS SIDE" if district_code == 392 & election == "1964 British general election"
replace district_name = "MANCHESTER,OPENSHAW" if district_code == 393 & election == "1964 British general election"
replace district_name = "MANCHESTER,WITHINGTON" if district_code == 394 & election == "1964 British general election"
replace district_name = "MANCHESTER,WYTHENSHAWE" if district_code == 395 & election == "1964 British general election"
replace district_name = "MANSFIELD" if district_code == 396 & election == "1964 British general election"
replace district_name = "MELTON" if district_code == 397 & election == "1964 British general election"
replace district_name = "MERIDEN" if district_code == 398 & election == "1964 British general election"
replace district_name = "MERIONETH" if district_code == 399 & election == "1964 British general election"
replace district_name = "MERTHYR TYDFIL" if district_code == 400 & election == "1964 British general election"
replace district_name = "MERTON AND MORDEN" if district_code == 401 & election == "1964 British general election"
replace district_name = "MIDDLESBROUGH,EAST" if district_code == 402 & election == "1964 British general election"
replace district_name = "MIDDLESBROUGH,WEST" if district_code == 403 & election == "1964 British general election"
replace district_name = "MIDDLETON AND PRESTWICK" if district_code == 404 & election == "1964 British general election"
replace district_name = "MIDLOTHIAN" if district_code == 405 & election == "1964 British general election"
replace district_name = "MITCHAM" if district_code == 406 & election == "1964 British general election"
replace district_name = "MONMOUTH" if district_code == 407 & election == "1964 British general election"
replace district_name = "MONTGOMERY" if district_code == 408 & election == "1964 British general election"
replace district_name = "MORAY AND NAIRN" if district_code == 409 & election == "1964 British general election"
replace district_name = "MORECAMBE AND LONSDALE" if district_code == 410 & election == "1964 British general election"
replace district_name = "MORPETH" if district_code == 411 & election == "1964 British general election"
replace district_name = "MOTHERWELL" if district_code == 412 & election == "1964 British general election"
replace district_name = "NANTWICH" if district_code == 413 & election == "1964 British general election"
replace district_name = "NEATH" if district_code == 414 & election == "1964 British general election"
replace district_name = "NELSON AND COLNE" if district_code == 415 & election == "1964 British general election"
replace district_name = "NEWARK" if district_code == 416 & election == "1964 British general election"
replace district_name = "NEWBURY" if district_code == 417 & election == "1964 British general election"
replace district_name = "NEWCASTLE UNDER LYME" if district_code == 418 & election == "1964 British general election"
replace district_name = "NEWCASTLE-UPON-TYNE CENTRAL" if district_code == 419 & election == "1964 British general election"
replace district_name = "NEWCASTLE-UPON-TYNE EAST" if district_code == 420 & election == "1964 British general election"
replace district_name = "NEWCASTLE-UPON-TYNE NORTH" if district_code == 421 & election == "1964 British general election"
replace district_name = "NEWCASTLE-UPONTYNE WEST" if district_code == 422 & election == "1964 British general election"
replace district_name = "NEW FOREST" if district_code == 423 & election == "1964 British general election"
replace district_name = "NEWPORT" if district_code == 424 & election == "1964 British general election"
replace district_name = "NEWTON" if district_code == 425 & election == "1964 British general election"
replace district_name = "CENTRAL NORFOLK" if district_code == 426 & election == "1964 British general election"
replace district_name = "NORTH NORFOLK" if district_code == 427 & election == "1964 British general election"
replace district_name = "SOUTH NORFOLK" if district_code == 428 & election == "1964 British general election"
replace district_name = "SOUTH WEST NORFOLK" if district_code == 429 & election == "1964 British general election"
replace district_name = "NORMANTON" if district_code == 430 & election == "1964 British general election"
replace district_name = "NORTHAMPTON" if district_code == 431 & election == "1964 British general election"
replace district_name = "SOUTH NORTHAMPTONSHIRE" if district_code == 432 & election == "1964 British general election"
replace district_name = "NORTH FYLDE" if district_code == 433 & election == "1964 British general election"
replace district_name = "NORTHWICH" if district_code == 434 & election == "1964 British general election"
replace district_name = "NORWICH,NORTH" if district_code == 435 & election == "1964 British general election"
replace district_name = "NORWICH,SOUTH" if district_code == 436 & election == "1964 British general election"
replace district_name = "NOTTINGHAM,CENTRAL" if district_code == 437 & election == "1964 British general election"
replace district_name = "NOTTINGHAM,NORTH" if district_code == 438 & election == "1964 British general election"
replace district_name = "NOTTINGHAM,SOUTH" if district_code == 439 & election == "1964 British general election"
replace district_name = "NOTTINGHAM,WEST" if district_code == 440 & election == "1964 British general election"
replace district_name = "NUNEATON" if district_code == 441 & election == "1964 British general election"
replace district_name = "OGMORE" if district_code == 442 & election == "1964 British general election"
replace district_name = "OLDBURY AND HALESOWEN" if district_code == 443 & election == "1964 British general election"
replace district_name = "OLDHAM,EAST" if district_code == 444 & election == "1964 British general election"
replace district_name = "OLDHAM,WEST" if district_code == 445 & election == "1964 British general election"
replace district_name = "ORKNEY AND ZETLAND" if district_code == 446 & election == "1964 British general election"
replace district_name = "ORMSKIRK" if district_code == 447 & election == "1964 British general election"
replace district_name = "ORPINGTON" if district_code == 448 & election == "1964 British general election"
replace district_name = "OSWESTRY" if district_code == 449 & election == "1964 British general election"
replace district_name = "OXFORD" if district_code == 450 & election == "1964 British general election"
replace district_name = "PADDINGTON,NORTH" if district_code == 451 & election == "1964 British general election"
replace district_name = "PADDINGTON,SOUTH" if district_code == 452 & election == "1964 British general election"
replace district_name = "PAISLEY" if district_code == 453 & election == "1964 British general election"
replace district_name = "PEMBROKE" if district_code == 454 & election == "1964 British general election"
replace district_name = "PENISTONE" if district_code == 455 & election == "1964 British general election"
replace district_name = "PENRITH AND THE BORDERS" if district_code == 456 & election == "1964 British general election"
replace district_name = "PERTH AND EAST PERTHSHIRE" if district_code == 457 & election == "1964 British general election"
replace district_name = "PETERBOROUGH" if district_code == 458 & election == "1964 British general election"
replace district_name = "PETERSFIELD" if district_code == 459 & election == "1964 British general election"
replace district_name = "PLYMOUTH,DEVONPORT" if district_code == 460 & election == "1964 British general election"
replace district_name = "PLYMOUTH,SUTTON" if district_code == 461 & election == "1964 British general election"
replace district_name = "PONTEFRACT" if district_code == 462 & election == "1964 British general election"
replace district_name = "PONTYPOOL" if district_code == 463 & election == "1964 British general election"
replace district_name = "PONTYPRIDD" if district_code == 464 & election == "1964 British general election"
replace district_name = "POOLE" if district_code == 465 & election == "1964 British general election"
replace district_name = "POPLAR" if district_code == 466 & election == "1964 British general election"
replace district_name = "PORTSMOUTH,LANGSTON" if district_code == 467 & election == "1964 British general election"
replace district_name = "PORTSMOUTH,SOUTH" if district_code == 468 & election == "1964 British general election"
replace district_name = "PORTSMOUTH,WEST" if district_code == 469 & election == "1964 British general election"
replace district_name = "PRESTON,NORTH" if district_code == 470 & election == "1964 British general election"
replace district_name = "PRESTON,SOUTH" if district_code == 471 & election == "1964 British general election"
replace district_name = "PUDSEY" if district_code == 472 & election == "1964 British general election"
replace district_name = "READING" if district_code == 473 & election == "1964 British general election"
replace district_name = "REIGATE" if district_code == 474 & election == "1964 British general election"
replace district_name = "EAST RENFREWSHIRE" if district_code == 475 & election == "1964 British general election"
replace district_name = "WEST RENFREWSHIRE" if district_code == 476 & election == "1964 British general election"
replace district_name = "RHONDDA,EAST" if district_code == 477 & election == "1964 British general election"
replace district_name = "RHONDDA,WEST" if district_code == 478 & election == "1964 British general election"
replace district_name = "RICHMOND (SURREY)" if district_code == 479 & election == "1964 British general election"
replace district_name = "RICHMOND (YORKSHIRE)" if district_code == 480 & election == "1964 British general election"
replace district_name = "RIPON" if district_code == 481 & election == "1964 British general election"
replace district_name = "ROCHDALE" if district_code == 482 & election == "1964 British general election"
replace district_name = "ROCHESTER AND CHATHAM" if district_code == 483 & election == "1964 British general election"
replace district_name = "ROMFORD" if district_code == 484 & election == "1964 British general election"
replace district_name = "ROSS AND CROMARTY" if district_code == 485 & election == "1964 British general election"
replace district_name = "ROSSENDALE" if district_code == 486 & election == "1964 British general election"
replace district_name = "ROTHERHAM" if district_code == 487 & election == "1964 British general election"
replace district_name = "ROTHER VALLEY" if district_code == 488 & election == "1964 British general election"
replace district_name = "ROWLEY REGIS AND TIPTON" if district_code == 489 & election == "1964 British general election"
replace district_name = "ROXBURGH, SELKIRK AND PEEBLES" if district_code == 490 & election == "1964 British general election"
replace district_name = "RUGBY" if district_code == 491 & election == "1964 British general election"
replace district_name = "RUISLIP-NORTHWOOD" if district_code == 492 & election == "1964 British general election"
replace district_name = "RUNCORN" if district_code == 493 & election == "1964 British general election"
replace district_name = "RUSHCLIFFE" if district_code == 494 & election == "1964 British general election"
replace district_name = "RUTHERGLEN" if district_code == 495 & election == "1964 British general election"
replace district_name = "RUTLAND AND STAMFORD" if district_code == 496 & election == "1964 British general election"
replace district_name = "RYE" if district_code == 497 & election == "1964 British general election"
replace district_name = "SAFFRON WALDON" if district_code == 498 & election == "1964 British general election"
replace district_name = "ST.ALBANS" if district_code == 499 & election == "1964 British general election"
replace district_name = "ST.HELENS" if district_code == 500 & election == "1964 British general election"
replace district_name = "ST.IVES" if district_code == 501 & election == "1964 British general election"
replace district_name = "ST.MARYLEBONE" if district_code == 502 & election == "1964 British general election"
replace district_name = "ST.PANCRAS NORTH" if district_code == 503 & election == "1964 British general election"
replace district_name = "SALFORD,EAST" if district_code == 504 & election == "1964 British general election"
replace district_name = "SALFORD,WEST" if district_code == 505 & election == "1964 British general election"
replace district_name = "SALISBURY" if district_code == 506 & election == "1964 British general election"
replace district_name = "SCARBOROUGH AND WHITBY" if district_code == 507 & election == "1964 British general election"
replace district_name = "SEDGEFIELD" if district_code == 508 & election == "1964 British general election"
replace district_name = "SEVENOAKS" if district_code == 509 & election == "1964 British general election"
replace district_name = "SHEFFIELD,ATTERCLIFFE" if district_code == 510 & election == "1964 British general election"
replace district_name = "SHEFFIELD,BRIGHTSIDE" if district_code == 511 & election == "1964 British general election"
replace district_name = "SHEFFIELD,HALLAM" if district_code == 512 & election == "1964 British general election"
replace district_name = "SHEFFIELD,HEELEY" if district_code == 513 & election == "1964 British general election"
replace district_name = "SHEFFIELD,HILLSBOROUGH" if district_code == 514 & election == "1964 British general election"
replace district_name = "SHEFFIELD,PARK" if district_code == 515 & election == "1964 British general election"
replace district_name = "SHIPLEY" if district_code == 516 & election == "1964 British general election"
replace district_name = "SHOREDITCH AND FINSBURY" if district_code == 517 & election == "1964 British general election"
replace district_name = "SHREWSBURY" if district_code == 518 & election == "1964 British general election"
replace district_name = "SKIPTON" if district_code == 519 & election == "1964 British general election"
replace district_name = "SMETHWICK" if district_code == 520 & election == "1964 British general election"
replace district_name = "SOLIHULL" if district_code == 521 & election == "1964 British general election"
replace district_name = "NORTH SOMERSET" if district_code == 522 & election == "1964 British general election"
replace district_name = "SOUTHALL" if district_code == 523 & election == "1964 British general election"
replace district_name = "SOUTHAMPTON,ITCHEN" if district_code == 524 & election == "1964 British general election"
replace district_name = "SOUTHAMPTON,TEST" if district_code == 525 & election == "1964 British general election"
replace district_name = "SOUTHEND EAST" if district_code == 526 & election == "1964 British general election"
replace district_name = "SOUTHEND WEST" if district_code == 527 & election == "1964 British general election"
replace district_name = "SOUTH FYLDE" if district_code == 528 & election == "1964 British general election"
replace district_name = "SOUTHGATE" if district_code == 529 & election == "1964 British general election"
replace district_name = "SOUTHPORT" if district_code == 530 & election == "1964 British general election"
replace district_name = "SOUTH SHIELDS" if district_code == 531 & election == "1964 British general election"
replace district_name = "SOUTHWARK" if district_code == 532 & election == "1964 British general election"
replace district_name = "SOWERBY" if district_code == 533 & election == "1964 British general election"
replace district_name = "SPELTHORNE" if district_code == 534 & election == "1964 British general election"
replace district_name = "STAFFORD AND STONE" if district_code == 535 & election == "1964 British general election"
replace district_name = "STALYBRIDGE AND HYDE" if district_code == 536 & election == "1964 British general election"
replace district_name = "STEPNEY" if district_code == 537 & election == "1964 British general election"
replace district_name = "STIRLING AND FALKIRK" if district_code == 538 & election == "1964 British general election"
replace district_name = "CLACKMANNAN AND EAST STIRLINGSHIRE" if district_code == 539 & election == "1964 British general election"
replace district_name = "WEST STIRLINGSHIRE" if district_code == 540 & election == "1964 British general election"
replace district_name = "STOCKPORT NORTH" if district_code == 541 & election == "1964 British general election"
replace district_name = "STOCKPORT SOUTH" if district_code == 542 & election == "1964 British general election"
replace district_name = "STOCKTON-ON-TEES" if district_code == 543 & election == "1964 British general election"
replace district_name = "STOKE NEWINGTON AND HACKNEY NORTH" if district_code == 544 & election == "1964 British general election"
replace district_name = "STOKE ON TRENT,CENTRAL" if district_code == 545 & election == "1964 British general election"
replace district_name = "STOKE ON TRENT,NORTH" if district_code == 546 & election == "1964 British general election"
replace district_name = "STOKE ON TRENT,SOUTH" if district_code == 547 & election == "1964 British general election"
replace district_name = "STRATFORD" if district_code == 548 & election == "1964 British general election"
replace district_name = "STRETFORD" if district_code == 549 & election == "1964 British general election"
replace district_name = "STROUD" if district_code == 550 & election == "1964 British general election"
replace district_name = "SUDBURY AND WOODBRIDGE" if district_code == 551 & election == "1964 British general election"
replace district_name = "SUNDERLAND NORTH" if district_code == 552 & election == "1964 British general election"
replace district_name = "SUNDERLAND SOUTH" if district_code == 553 & election == "1964 British general election"
replace district_name = "SURBITON" if district_code == 554 & election == "1964 British general election"
replace district_name = "EAST SURREY" if district_code == 555 & election == "1964 British general election"
replace district_name = "SUTTON AND CHEAM" if district_code == 556 & election == "1964 British general election"
replace district_name = "SUTTON COLDFIELD" if district_code == 557 & election == "1964 British general election"
replace district_name = "SWANSEA,EAST" if district_code == 558 & election == "1964 British general election"
replace district_name = "SWANSEA,WEST" if district_code == 559 & election == "1964 British general election"
replace district_name = "SWINDON" if district_code == 560 & election == "1964 British general election"
replace district_name = "TAUNTON" if district_code == 561 & election == "1964 British general election"
replace district_name = "TAVISTOCK" if district_code == 562 & election == "1964 British general election"
replace district_name = "THIRSK AND MALTON" if district_code == 563 & election == "1964 British general election"
replace district_name = "THURROCK" if district_code == 564 & election == "1964 British general election"
replace district_name = "TIVERTON" if district_code == 565 & election == "1964 British general election"
replace district_name = "TONBRIDGE" if district_code == 566 & election == "1964 British general election"
replace district_name = "TORQUAY" if district_code == 567 & election == "1964 British general election"
replace district_name = "TORRINGTON" if district_code == 568 & election == "1964 British general election"
replace district_name = "TOTNES" if district_code == 569 & election == "1964 British general election"
replace district_name = "TOTTENHAM" if district_code == 570 & election == "1964 British general election"
replace district_name = "TRURO" if district_code == 571 & election == "1964 British general election"
replace district_name = "TWICKENHAM" if district_code == 572 & election == "1964 British general election"
replace district_name = "TYNEMOUTH" if district_code == 573 & election == "1964 British general election"
replace district_name = "ULSTER MID" if district_code == 574 & election == "1964 British general election"
replace district_name = "UXBRIDGE" if district_code == 575 & election == "1964 British general election"
replace district_name = "WAKEFIELD" if district_code == 576 & election == "1964 British general election"
replace district_name = "WALLASEY" if district_code == 577 & election == "1964 British general election"
replace district_name = "WALLSEND" if district_code == 578 & election == "1964 British general election"
replace district_name = "WALSALL,NORTH" if district_code == 579 & election == "1964 British general election"
replace district_name = "WALSALL,SOUTH" if district_code == 580 & election == "1964 British general election"
replace district_name = "WALTHAMSTOW,EAST" if district_code == 581 & election == "1964 British general election"
replace district_name = "WALTHAMSTOW,WEST" if district_code == 582 & election == "1964 British general election"
replace district_name = "WANDSWORTH,CENTRAL" if district_code == 583 & election == "1964 British general election"
replace district_name = "WANDSWORTH,CLAPHAM" if district_code == 584 & election == "1964 British general election"
replace district_name = "WANDSWORTH,PUTNEY" if district_code == 585 & election == "1964 British general election"
replace district_name = "WANDSWORTH,STREATHAM" if district_code == 586 & election == "1964 British general election"
replace district_name = "WANSTEAD AND WOODFORD" if district_code == 587 & election == "1964 British general election"
replace district_name = "WARRINGTON" if district_code == 588 & election == "1964 British general election"
replace district_name = "WARWICK AND LEAMINGTON" if district_code == 589 & election == "1964 British general election"
replace district_name = "WATFORD" if district_code == 590 & election == "1964 British general election"
replace district_name = "WEDNESBURY" if district_code == 591 & election == "1964 British general election"
replace district_name = "WELLINGBOROUGH" if district_code == 592 & election == "1964 British general election"
replace district_name = "WELLS" if district_code == 593 & election == "1964 British general election"
replace district_name = "WEMBLEY NORTH" if district_code == 594 & election == "1964 British general election"
replace district_name = "WEMBLEY SOUTH" if district_code == 595 & election == "1964 British general election"
replace district_name = "WEST BROMWICH" if district_code == 596 & election == "1964 British general election"
replace district_name = "WESTBURY" if district_code == 597 & election == "1964 British general election"
replace district_name = "WESTERN ISLES" if district_code == 598 & election == "1964 British general election"
replace district_name = "WEST HAM NORTH" if district_code == 599 & election == "1964 British general election"
replace district_name = "WEST HAM SOUTH" if district_code == 600 & election == "1964 British general election"
replace district_name = "WESTHOUGHTON" if district_code == 601 & election == "1964 British general election"
replace district_name = "WEST LOTHIAN" if district_code == 602 & election == "1964 British general election"
replace district_name = "WESTMORLAND" if district_code == 603 & election == "1964 British general election"
replace district_name = "WESTON SUPER MARE" if district_code == 604 & election == "1964 British general election"
replace district_name = "WHITEHAVEN" if district_code == 605 & election == "1964 British general election"
replace district_name = "WIDNES" if district_code == 606 & election == "1964 British general election"
replace district_name = "WIGAN" if district_code == 607 & election == "1964 British general election"
replace district_name = "WILLESDEN,EAST" if district_code == 608 & election == "1964 British general election"
replace district_name = "WILLESDEN,WEST" if district_code == 609 & election == "1964 British general election"
replace district_name = "WIMBLEDON" if district_code == 610 & election == "1964 British general election"
replace district_name = "WINCHESTER" if district_code == 611 & election == "1964 British general election"
replace district_name = "WINDSOR" if district_code == 612 & election == "1964 British general election"
replace district_name = "WIRRAL" if district_code == 613 & election == "1964 British general election"
replace district_name = "WOKING" if district_code == 614 & election == "1964 British general election"
replace district_name = "WOKINGHAM" if district_code == 615 & election == "1964 British general election"
replace district_name = "WOLVERHAMPTON NORTH EAST" if district_code == 616 & election == "1964 British general election"
replace district_name = "WOLVERHAMPTON SOUTH WEST" if district_code == 617 & election == "1964 British general election"
replace district_name = "WOOD GREEN" if district_code == 618 & election == "1964 British general election"
replace district_name = "WOOLWICH,EAST" if district_code == 619 & election == "1964 British general election"
replace district_name = "WOOLWICH,WEST" if district_code == 620 & election == "1964 British general election"
replace district_name = "WORCESTER" if district_code == 621 & election == "1964 British general election"
replace district_name = "SOUTH WORCESTERSHIRE" if district_code == 622 & election == "1964 British general election"
replace district_name = "WORKINGTON" if district_code == 623 & election == "1964 British general election"
replace district_name = "WORTHING" if district_code == 624 & election == "1964 British general election"
replace district_name = "THE WREKIN" if district_code == 625 & election == "1964 British general election"
replace district_name = "WREXHAM" if district_code == 626 & election == "1964 British general election"
replace district_name = "WYCOMBE" if district_code == 627 & election == "1964 British general election"
replace district_name = "YARMOUTH" if district_code == 628 & election == "1964 British general election"
replace district_name = "YEOVIL" if district_code == 629 & election == "1964 British general election"
replace district_name = "YORK" if district_code == 630 & election == "1964 British general election"

* Harmonize district names

replace district_name = lower(district_name)
replace district_name = subinstr(district_name," & "," and ",.)
replace district_name = subinstr(district_name,"  "," ",.)
replace district_name = subinstr(district_name,"--","-",.)
replace district_name = subinstr(district_name,"–","-",.)
replace district_name = subinstr(district_name," - ","-",.)
replace district_name = subinstr(district_name," / ","/",.)
replace district_name = subinstr(district_name,", ",",",.)
replace district_name = subinstr(district_name,"é","e",.)
replace district_name = subinstr(district_name,"É","e",.)
replace district_name = subinstr(district_name,"è","e",.)
replace district_name = subinstr(district_name,"ë","e",.)
replace district_name = subinstr(district_name,"ê","e",.)
replace district_name = subinstr(district_name,"ä","a",.)
replace district_name = subinstr(district_name,"â","a",.)
replace district_name = subinstr(district_name,"ö","o",.)
replace district_name = subinstr(district_name,"ô","o",.)
replace district_name = subinstr(district_name,"ü","u",.)
replace district_name = subinstr(district_name,"û","u",.)
replace district_name = subinstr(district_name,"ï","i",.)
replace district_name = subinstr(district_name,"î","i",.)
replace district_name = subinstr(district_name,"Î","i",.)
replace district_name = subinstr(district_name,"ç","c",.)
replace district_name = subinstr(district_name,"ç","c",.)
replace district_name = subinstr(district_name,"Ãle","ile",.)
replace district_name = subinstr(district_name,"Ã¢","a",.)
replace district_name = subinstr(district_name,"Ã®","i",.)
replace district_name = subinstr(district_name,"Ã©","e",.)
replace district_name = subinstr(district_name,"Ã¨","e",.)
replace district_name = subinstr(district_name,"Ã","e",.)
replace district_name = subinstr(district_name,"st. ","st.",.)
replace district_name = subinstr(district_name,"ste. ","ste.",.)

split district_name if strpos(election, "Canadian federal election") > 0, p(/) l(1)
replace district_name = district_name1 if district_name1!=""
drop district_name1

* Number of observations

egen observations = sum(sample), by(study_id)

egen total = total(observations), by(study_id)


******************************
** MERGE WITH ELECTION DATA **
******************************

gen house = "House" if study_id == "us2000-ANES-USH"
replace house = "Senate" if study_id == "us2000-ANES-USS"

rename enep enep_d
rename margin margin_d

gen code = substr(study_id,1,6) if study_id!="mtl2017-CMES-M" & study_id!="esA2016-CIS-N" & study_id!="esN2016-CIS-N"

replace code = substr(study_id,1,7) if study_id == "mtl2017-CMES-M" | study_id == "esA2016-CIS-N" | study_id == "esN2016-CIS-N"

merge m:1 code region election_level election_type house using "margin_enep_w.dta", keepusing(margin_w enep_w)

replace enep_d = . if election_level == "National" | election_level == "Regional"
replace margin_d = . if election_level == "National" | election_level == "Regional"
replace enep_w = . if election_level == "District" | election_level == "State"
replace margin_w = . if election_level == "District" | election_level == "State"

drop _merge


****************************************
** CREATE COMMON SCALES FOR VARIABLES **
****************************************

* Convert study ID to numeric values

encode study_id, generate(study_id_n)

* Generate common scales for education (postsecondary = 1, otherwise = 0)

gen postsecondary = .

replace postsecondary = 1 if education > 3 & strpos(study_id, "us1984-ANES") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "us1984-ANES") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "us1988-ANES") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "us1988-ANES") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "us1992-ANES") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "us1992-ANES") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "us1996-ANES") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "us1996-ANES") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "us2000-ANES") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "us2000-ANES") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "us2004-ANES") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "us2004-ANES") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "us2008-ANES") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "us2008-ANES") > 0 & education!=.

replace postsecondary = 1 if education > 2 & strpos(study_id, "us2012-ANES") > 0
replace postsecondary = 0 if education <= 2 & strpos(study_id, "us2012-ANES") > 0 & education!=.

replace postsecondary = 1 if education > 2 & strpos(study_id, "us2016-ANES") > 0
replace postsecondary = 0 if education <= 2 & strpos(study_id, "us2016-ANES") > 0 & education!=.

replace postsecondary = 1 if education > 2 & strpos(study_id, "us2016-TAPS") > 0
replace postsecondary = 0 if education <= 2 & strpos(study_id, "us2016-TAPS") > 0 & education!=.

replace postsecondary = 1 if education > 2 & strpos(study_id, "us2020-ANES") > 0
replace postsecondary = 0 if education <= 2 & strpos(study_id, "us2020-ANES") > 0 & education!=.

replace postsecondary = 1 if education > 7 & strpos(study_id, "AUTNES") > 0
replace postsecondary = 0 if education <= 7 & strpos(study_id, "AUTNES") > 0 & education!=.

replace postsecondary = 1 if education > 4 & strpos(study_id, "GFES") > 0
replace postsecondary = 0 if education <= 4 & strpos(study_id, "GFES") > 0 & education!=.

replace postsecondary = 1 if education > 4 & strpos(study_id, "GLES-N") > 0 | education > 4 & strpos(study_id, "GLES-D") > 0 | education > 4 & study_id == "ni2013-GLES-R" | education > 4 & study_id == "nw2012-GLES-R"
replace postsecondary = 0 if education <= 4 & strpos(study_id, "GLES-N") > 0 & education!=. | education <= 4 & strpos(study_id, "GLES-D") > 0 & education!=. | education <= 4 & study_id == "ni2013-GLES-R" & education!=. | education <= 4 & study_id == "nw2012-GLES-R" & education!=.

replace postsecondary = 1 if education > 6 & strpos(study_id, "GLES-R") > 0 & study_id!="ni2013-GLES-R" & study_id!="nw2012-GLES-R"
replace postsecondary = 0 if education <= 6 & strpos(study_id, "GLES-R") > 0 & education!=. & study_id!="ni2013-GLES-R" & study_id!="nw2012-GLES-R"

replace postsecondary = 1 if education > 5 & strpos(study_id, "CES") > 0
replace postsecondary = 0 if education <= 5 & strpos(study_id, "CES") > 0 & education!=.

replace postsecondary = 1 if education > 5 & strpos(study_id, "on2003-OES") > 0
replace postsecondary = 0 if education <= 5 & strpos(study_id, "on2003-OES") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "on2007-OES") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "on2007-OES") > 0 & education!=.

replace postsecondary = 1 if education > 5 & strpos(study_id, "CMES") > 0
replace postsecondary = 0 if education <= 5 & strpos(study_id, "CMES") > 0 & education!=.

replace postsecondary = 1 if education > 4 & strpos(study_id, "NZES") > 0
replace postsecondary = 0 if education <= 4 & strpos(study_id, "NZES") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "Ipsos-N") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "Ipsos-N") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "on2011-Ipsos") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "on2011-Ipsos") > 0 & education!=.

replace postsecondary = 1 if education > 2 & strpos(study_id, "on2014-Ipsos") > 0
replace postsecondary = 0 if education <= 2 & strpos(study_id, "on2014-Ipsos") > 0 & education!=.

replace postsecondary = 1 if education > 5 & strpos(study_id, "SKPES") > 0
replace postsecondary = 0 if education <= 5 & strpos(study_id, "SKPES") > 0 & education!=.

replace postsecondary = 1 if education > 4 & strpos(study_id, "gb1964-BES")
replace postsecondary = 0 if education <= 4 & strpos(study_id, "gb1964-BES") > 0 & education!=.

replace postsecondary = 1 if education > 4 & strpos(study_id, "gb1987-BES")
replace postsecondary = 0 if education <= 4 & strpos(study_id, "gb1987-BES") > 0 & education!=.

replace postsecondary = 1 if education > 2 & strpos(study_id, "gb2005-BES")
replace postsecondary = 0 if education <= 2 & strpos(study_id, "gb2005-BES") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "gb2015-BES") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "gb2015-BES") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "gb2017-BES") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "gb2017-BES") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "gb2019-BES") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "gb2019-BES") > 0 & education!=.

replace postsecondary = 1 if education > 12 & strpos(study_id, "il1992-INES") > 0
replace postsecondary = 0 if education <= 12 & strpos(study_id, "il1992-INES") > 0 & education!=.

replace postsecondary = 1 if education > 12 & strpos(study_id, "il1996-INES") > 0
replace postsecondary = 0 if education <= 12 & strpos(study_id, "il1996-INES") > 0 & education!=.

replace postsecondary = 1 if education > 12 & strpos(study_id, "il2003-INES") > 0
replace postsecondary = 0 if education <= 12 & strpos(study_id, "il2003-INES") > 0 & education!=.

replace postsecondary = 1 if education > 12 & strpos(study_id, "il2009-INES") > 0
replace postsecondary = 0 if education <= 12 & strpos(study_id, "il2009-INES") > 0 & education!=.

replace postsecondary = 1 if education > 4 & strpos(study_id, "il2015-INES") > 0
replace postsecondary = 0 if education <= 4 & strpos(study_id, "il2015-INES") > 0 & education!=.

replace postsecondary = 1 if education > 4 & strpos(study_id, "il2020-INES") > 0
replace postsecondary = 0 if education <= 4 & strpos(study_id, "il2020-INES") > 0 & education!=.

replace postsecondary = 1 if education > 5 & strpos(study_id, "il2021-INES") > 0
replace postsecondary = 0 if education <= 5 & strpos(study_id, "il2021-INES") > 0 & education!=.

replace postsecondary = 1 if education > 3 & strpos(study_id, "NAES") > 0
replace postsecondary = 0 if education <= 3 & strpos(study_id, "NAES") > 0 & education!=.

replace postsecondary = 1 if education > 9 & strpos(study_id, "UAS") > 0
replace postsecondary = 0 if education <= 9 & strpos(study_id, "UAS") > 0 & education!=.

replace postsecondary = 1 if education > 8 & strpos(study_id, "ITANES") > 0
replace postsecondary = 0 if education <= 8 & strpos(study_id, "ITANES") > 0 & education!=.

replace postsecondary = 1 if education > 6 & strpos(study_id, "PVS") > 0
replace postsecondary = 0 if education <= 6 & strpos(study_id, "PVS") > 0 & education!=.

replace postsecondary = 1 if education > 4 & strpos(study_id, "CIS") > 0
replace postsecondary = 0 if education <= 4 & strpos(study_id, "CIS") > 0 & education!=.

* Generate dummy variable for wishful thinking (loser = 1, independent = 2, winner = 3)

gen wishful_3pts = .

replace wishful_3pts = 1 if wishful >= 1 & wishful < 4 & strpos(study_id, "AUTNES") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 4 & strpos(study_id, "AUTNES") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 4 & strpos(study_id, "AUTNES") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 4 & strpos(study_id, "CES") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 4 & strpos(study_id, "CES") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 4 & strpos(study_id, "CES") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 4 & strpos(study_id, "GLES-R") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 4 & strpos(study_id, "GLES-R") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 4 & strpos(study_id, "GLES-R") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 4 & strpos(study_id, "GLES-N") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 4 & strpos(study_id, "GLES-N") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 4 & strpos(study_id, "GLES-N") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 4 & strpos(study_id, "ITANES") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 4 & strpos(study_id, "ITANES") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 4 & strpos(study_id, "ITANES") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 4 & strpos(study_id, "NZES") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 4 & strpos(study_id, "NZES") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 4 & strpos(study_id, "NZES") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 4 & strpos(study_id, "on2003") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 4 & strpos(study_id, "on2003") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 4 & strpos(study_id, "on2003") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 4 & strpos(study_id, "il2003") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 4 & strpos(study_id, "il2003") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 4 & strpos(study_id, "il2003") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 4 & strpos(study_id, "pt2009") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 4 & strpos(study_id, "pt2009") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 4 & strpos(study_id, "pt2009") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 4 & strpos(study_id, "SKPES") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 4 & strpos(study_id, "SKPES") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 4 & strpos(study_id, "SKPES") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 4 & strpos(study_id, "ANES") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 4 & strpos(study_id, "ANES") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 4 & strpos(study_id, "ANES") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 4 & strpos(study_id, "NAES-N") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 4 & strpos(study_id, "NAES-N") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 4 & strpos(study_id, "NAES-N") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 6 & strpos(study_id, "GLES-D") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 6 & strpos(study_id, "GLES-D") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 6 & strpos(study_id, "GLES-D") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 6 & strpos(study_id, "GFES") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 6 & strpos(study_id, "GFES") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 6 & strpos(study_id, "GFES") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 3 & strpos(study_id, "BES") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 3 & strpos(study_id, "BES") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 3 & strpos(study_id, "BES") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful >= 1 & wishful < 3 & strpos(study_id, "TAPS-N") > 0 & wishful!=.
replace wishful_3pts = 2 if wishful == 3 & strpos(study_id, "TAPS-N") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful > 3 & strpos(study_id, "TAPS-N") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful == 0 & strpos(study_id, "Ipsos") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful == 1 & strpos(study_id, "Ipsos") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful == 0 & strpos(study_id, "il1992") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful == 1 & strpos(study_id, "il1992") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful == 0 & strpos(study_id, "il1996") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful == 1 & strpos(study_id, "il1996") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful == 0 & strpos(study_id, "il2009") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful == 1 & strpos(study_id, "il2009") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful == 0 & strpos(study_id, "il2015") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful == 1 & strpos(study_id, "il2015") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful == 0 & strpos(study_id, "il2020") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful == 1 & strpos(study_id, "il2020") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful == 0 & strpos(study_id, "il2021") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful == 1 & strpos(study_id, "il2021") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful == 0 & strpos(study_id, "CIS") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful == 1 & strpos(study_id, "CIS") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful == 0 & strpos(study_id, "TAPS-DEM-P") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful == 1 & strpos(study_id, "TAPS-DEM-P") > 0 & wishful!=.

replace wishful_3pts = 1 if wishful == 0 & strpos(study_id, "TAPS-REP-P") > 0 & wishful!=.
replace wishful_3pts = 3 if wishful == 1 & strpos(study_id, "TAPS-REP-P") > 0 & wishful!=.

replace wishful_3pts = mayorpref if strpos(study_id, "CMES") > 0 & wishful!=.

replace wishful_3pts = reppreference if strpos(study_id, "us2000-NAES-REP-P") > 0 & wishful!=.
replace wishful_3pts = dempreference if strpos(study_id, "us2000-NAES-DEM-P") > 0 & wishful!=.

replace wishful_3pts = dempreference if strpos(study_id, "us2004-NAES-DEM-P") > 0 & wishful!=.

replace wishful_3pts = reppreference if strpos(study_id, "us2008-NAES-REP-P") > 0 & wishful!=.
replace wishful_3pts = dempreference if strpos(study_id, "us2008-NAES-DEM-P") > 0 & wishful!=.

* Generate random age within age category for 2011 Ontario General Election Exit Survey

gen age2 = age

replace age2 = floor((24-18+1)*runiform()+18) if age == 1 & strpos(study_id, "on2011") > 0
replace age2 = floor((34-25+1)*runiform()+25) if age == 2 & strpos(study_id, "on2011") > 0
replace age2 = floor((44-35+1)*runiform()+35) if age == 3 & strpos(study_id, "on2011") > 0
replace age2 = floor((54-45+1)*runiform()+45) if age == 4 & strpos(study_id, "on2011") > 0
replace age2 = floor((64-55+1)*runiform()+55) if age == 5 & strpos(study_id, "on2011") > 0
replace age2 = floor((100-65+1)*runiform()+65) if age == 6 & strpos(study_id, "on2011") > 0

* Replace

replace discussion_3pts = discussion if discussion_3pts == .
replace disagreement_3pts = disagreement if disagreement_3pts == .
replace size_3pts = size if size_3pts == .
replace expertise_4pts = expertise if expertise_4pts == .

* Label variables

label define postsecondary 0 "No postsecondary" 1 "Postsecondary"
label values postsecondary postsecondary

label define wishful_3pts 1 "Loser preference" 2 "No preference" 3 "Winner preference"
label values wishful_3pts wishful_3pts

label define discussion_3pts 0 "Low" 1 "Medium" 2 "High" 
label values discussion_3pts discussion_3pts

label define disagreement_3pts 0 "Low" 1 "Medium" 2 "High" 
label values disagreement_3pts disagreement_3pts

label define size_3pts 0 "Small" 1 "Medium" 2 "Large" 
label values size_3pts size_3pts

* Create unique ID for each region-election year district

gen district_unique = study_id + "-" + string(district_code, "%03.0f") if district_code!=.

* Create unique ID for each region-election year state (U.S. presidential elections)

gen state_unique = study_id + "-" + string(state, "%03.0f") if state!=.

* Create unique ID for each election

gen election_unique = code + "-" + election_type + "-" + election_level

replace election_unique = election_unique + "-H" if study_id == "us2000-ANES-USH"

replace election_unique = election_unique + "-S" if study_id == "us2000-ANES-USS"

* Create unique ID for each answer

gen id = _n

* Encode encode election_type, election_system, election_unique

encode election_type, generate(type)

encode election_system, generate(system)

encode election_unique, generate(electionid)

* Create dummy variable for Majoritarian vs Proportional

gen system2 = system

recode system2 1=. 2=1 3=1 4=0 5=0

label val system2

* Create dummy variable for Legislative vs Executive

gen type2 = type

recode type2 2=0 3=.

label val type2

* Create categories for poll margins

gen pollmarcat = " "

replace pollmarcat = "0-0.25" if pollmar >= 0 & pollmar <= 0.25
replace pollmarcat = "0.25-0.5" if pollmar > 0.25 & pollmar <= 0.5
replace pollmarcat = "0.5-0.75" if pollmar > 0.5 & pollmar <= 0.75
replace pollmarcat = "0.75-1" if pollmar > 0.75 & pollmar <= 1
replace pollmarcat = "1-1.25" if pollmar > 1 & pollmar <= 1.25
replace pollmarcat = "1.25-1.5" if pollmar > 1.25 & pollmar <= 1.5
replace pollmarcat = "1.5-1.75" if pollmar > 1.5 & pollmar <= 1.75
replace pollmarcat = "1.75-2" if pollmar > 1.75 & pollmar <= 2
replace pollmarcat = "2-2.25" if pollmar > 2 & pollmar <= 2.25
replace pollmarcat = "2.25-2.5" if pollmar > 2.25 & pollmar <= 2.5
replace pollmarcat = "2.5-2.75" if pollmar > 2.5 & pollmar <= 2.75
replace pollmarcat = "2.75-3" if pollmar > 2.75 & pollmar <= 3
replace pollmarcat = "3-3.25" if pollmar > 3 & pollmar <= 3.25
replace pollmarcat = "3.25-3.5" if pollmar > 3.25 & pollmar <= 3.5
replace pollmarcat = "3.5-3.75" if pollmar > 3.5 & pollmar <= 3.75
replace pollmarcat = "3.75-4" if pollmar > 3.75 & pollmar <= 4
replace pollmarcat = "4-4.25" if pollmar > 4 & pollmar <= 4.25
replace pollmarcat = "4.25-4.5" if pollmar > 4.25 & pollmar <= 4.5
replace pollmarcat = "4.5-4.75" if pollmar > 4.5 & pollmar <= 4.75
replace pollmarcat = "4.75-5" if pollmar > 4.75 & pollmar <= 5
replace pollmarcat = "5-5.25" if pollmar > 5 & pollmar <= 5.25
replace pollmarcat = "5.25-5.5" if pollmar > 5.25 & pollmar <= 5.5
replace pollmarcat = "5.5-5.75" if pollmar > 5.5 & pollmar <= 5.75
replace pollmarcat = "5.75-6" if pollmar > 5.75 & pollmar <= 6
replace pollmarcat = "6-6.25" if pollmar > 6 & pollmar <= 6.25
replace pollmarcat = "6.25-6.5" if pollmar > 6.25 & pollmar <= 6.5
replace pollmarcat = "6.5-6.75" if pollmar > 6.5 & pollmar <= 6.75
replace pollmarcat = "6.75-7" if pollmar > 6.75 & pollmar <= 7
replace pollmarcat = "7-7.25" if pollmar > 7 & pollmar <= 7.25
replace pollmarcat = "7.25-7.5" if pollmar > 7.25 & pollmar <= 7.5
replace pollmarcat = "7.5-7.75" if pollmar > 7.5 & pollmar <= 7.75
replace pollmarcat = "7.75-8" if pollmar > 7.75 & pollmar <= 8
replace pollmarcat = "8-8.25" if pollmar > 8 & pollmar <= 8.25
replace pollmarcat = "8.25-8.5" if pollmar > 8.25 & pollmar <= 8.5
replace pollmarcat = "8.5-8.75" if pollmar > 8.5 & pollmar <= 8.75
replace pollmarcat = "8.75-9" if pollmar > 8.75 & pollmar <= 9
replace pollmarcat = "9-9.25" if pollmar > 9 & pollmar <= 9.25
replace pollmarcat = "9.25-9.5" if pollmar > 9.25 & pollmar <= 9.5
replace pollmarcat = "9.5-9.75" if pollmar > 9.5 & pollmar <= 9.75
replace pollmarcat = "9.75-10" if pollmar > 9.75 & pollmar <= 10
replace pollmarcat = "10-10.25" if pollmar > 10 & pollmar <= 10.25
replace pollmarcat = "10.25-10.5" if pollmar > 10.25 & pollmar <= 10.5
replace pollmarcat = "10.5-10.75" if pollmar > 10.5 & pollmar <= 10.75
replace pollmarcat = "10.75-11" if pollmar > 10.75 & pollmar <= 11
replace pollmarcat = "11-11.25" if pollmar > 11 & pollmar <= 11.25
replace pollmarcat = "11.25-11.5" if pollmar > 11.25 & pollmar <= 11.5
replace pollmarcat = "11.5-11.75" if pollmar > 11.5 & pollmar <= 11.75
replace pollmarcat = "11.75-12" if pollmar > 11.75 & pollmar <= 12
replace pollmarcat = "12-12.25" if pollmar > 12 & pollmar <= 12.25
replace pollmarcat = "12.25-12.5" if pollmar > 12.25 & pollmar <= 12.5
replace pollmarcat = "12.5-12.75" if pollmar > 12.5 & pollmar <= 12.75
replace pollmarcat = "12.75-13" if pollmar > 12.75 & pollmar <= 13
replace pollmarcat = "13-13.25" if pollmar > 13 & pollmar <= 13.25
replace pollmarcat = "13.25-13.5" if pollmar > 13.25 & pollmar <= 13.5
replace pollmarcat = "13.5-13.75" if pollmar > 13.5 & pollmar <= 13.75
replace pollmarcat = "13.75-14" if pollmar > 13.75 & pollmar <= 14
replace pollmarcat = "14-14.25" if pollmar > 14 & pollmar <= 14.25
replace pollmarcat = "14.25-14.5" if pollmar > 14.25 & pollmar <= 14.5
replace pollmarcat = "14.5-14.75" if pollmar > 14.5 & pollmar <= 14.75
replace pollmarcat = "14.75-15" if pollmar > 14.75 & pollmar <= 15
replace pollmarcat = "15-15.25" if pollmar > 15 & pollmar <= 15.25
replace pollmarcat = "15.25-15.5" if pollmar > 15.25 & pollmar <= 15.5
replace pollmarcat = "15.5-15.75" if pollmar > 15.5 & pollmar <= 15.75
replace pollmarcat = "15.75-16" if pollmar > 15.75 & pollmar <= 16
replace pollmarcat = "16-16.25" if pollmar > 16 & pollmar <= 16.25
replace pollmarcat = "16.25-16.5" if pollmar > 16.25 & pollmar <= 16.5
replace pollmarcat = "16.5-16.75" if pollmar > 16.5 & pollmar <= 16.75
replace pollmarcat = "16.75-17" if pollmar > 16.75 & pollmar <= 17
replace pollmarcat = "17-17.25" if pollmar > 17 & pollmar <= 17.25
replace pollmarcat = "17.25-17.5" if pollmar > 17.25 & pollmar <= 17.5
replace pollmarcat = "17.5-17.75" if pollmar > 17.5 & pollmar <= 17.75
replace pollmarcat = "17.75-18" if pollmar > 17.75 & pollmar <= 18
replace pollmarcat = "18-18.25" if pollmar > 18 & pollmar <= 18.25
replace pollmarcat = "18.25-18.5" if pollmar > 18.25 & pollmar <= 18.5
replace pollmarcat = "18.5-18.75" if pollmar > 18.5 & pollmar <= 18.75
replace pollmarcat = "18.75-19" if pollmar > 18.75 & pollmar <= 19
replace pollmarcat = "19-19.25" if pollmar > 19 & pollmar <= 19.25
replace pollmarcat = "19.25-19.5" if pollmar > 19.25 & pollmar <= 19.5
replace pollmarcat = "19.5-19.75" if pollmar > 19.5 & pollmar <= 19.75
replace pollmarcat = "19.75-20" if pollmar > 19.75 & pollmar <= 20
replace pollmarcat = "20-20.25" if pollmar > 20 & pollmar <= 20.25
replace pollmarcat = "20.25-20.5" if pollmar > 20.25 & pollmar <= 20.5
replace pollmarcat = "20.5-20.75" if pollmar > 20.5 & pollmar <= 20.75
replace pollmarcat = "20.75-21" if pollmar > 20.75 & pollmar <= 21
replace pollmarcat = "21-21.25" if pollmar > 21 & pollmar <= 21.25
replace pollmarcat = "21.25-21.5" if pollmar > 21.25 & pollmar <= 21.5
replace pollmarcat = "21.5-21.75" if pollmar > 21.5 & pollmar <= 21.75
replace pollmarcat = "21.75-22" if pollmar > 21.75 & pollmar <= 22
replace pollmarcat = "22-22.25" if pollmar > 22 & pollmar <= 22.25
replace pollmarcat = "22.25-22.5" if pollmar > 22.25 & pollmar <= 22.5
replace pollmarcat = "22.5-22.75" if pollmar > 22.5 & pollmar <= 22.75
replace pollmarcat = "22.75-23" if pollmar > 22.75 & pollmar <= 23
replace pollmarcat = "23-23.25" if pollmar > 23 & pollmar <= 23.25
replace pollmarcat = "23.25-23.5" if pollmar > 23.25 & pollmar <= 23.5
replace pollmarcat = "23.5-23.75" if pollmar > 23.5 & pollmar <= 23.75
replace pollmarcat = "23.75-24" if pollmar > 23.75 & pollmar <= 24
replace pollmarcat = "24-24.25" if pollmar > 24 & pollmar <= 24.25
replace pollmarcat = "24.25-24.5" if pollmar > 24.25 & pollmar <= 24.5
replace pollmarcat = "24.5-24.75" if pollmar > 24.5 & pollmar <= 24.75
replace pollmarcat = "24.75-25" if pollmar > 24.75 & pollmar <= 25
replace pollmarcat = "25-25.25" if pollmar > 25 & pollmar <= 25.25
replace pollmarcat = "25.25-25.5" if pollmar > 25.25 & pollmar <= 25.5
replace pollmarcat = "25.5-25.75" if pollmar > 25.5 & pollmar <= 25.75
replace pollmarcat = "25.75-26" if pollmar > 25.75 & pollmar <= 26
replace pollmarcat = "26-26.25" if pollmar > 26 & pollmar <= 26.25
replace pollmarcat = "26.25-26.5" if pollmar > 26.25 & pollmar <= 26.5
replace pollmarcat = "26.5-26.75" if pollmar > 26.5 & pollmar <= 26.75
replace pollmarcat = "26.75-27" if pollmar > 26.75 & pollmar <= 27
replace pollmarcat = "27-27.25" if pollmar > 27 & pollmar <= 27.25
replace pollmarcat = "27.25-27.5" if pollmar > 27.25 & pollmar <= 27.5
replace pollmarcat = "27.5-27.75" if pollmar > 27.5 & pollmar <= 27.75
replace pollmarcat = "27.75-28" if pollmar > 27.75 & pollmar <= 28
replace pollmarcat = "28-28.25" if pollmar > 28 & pollmar <= 28.25
replace pollmarcat = "28.25-28.5" if pollmar > 28.25 & pollmar <= 28.5
replace pollmarcat = "28.5-28.75" if pollmar > 28.5 & pollmar <= 28.75
replace pollmarcat = "28.75-29" if pollmar > 28.75 & pollmar <= 29
replace pollmarcat = "29-29.25" if pollmar > 29 & pollmar <= 29.25
replace pollmarcat = "29.25-29.5" if pollmar > 29.25 & pollmar <= 29.5
replace pollmarcat = "29.5-29.75" if pollmar > 29.5 & pollmar <= 29.75
replace pollmarcat = "29.75-30" if pollmar > 29.75 & pollmar <= 30
replace pollmarcat = "30-30.25" if pollmar > 30 & pollmar <= 30.25
replace pollmarcat = "30.25-30.5" if pollmar > 30.25 & pollmar <= 30.5
replace pollmarcat = "30.5-30.75" if pollmar > 30.5 & pollmar <= 30.75
replace pollmarcat = "30.75-31" if pollmar > 30.75 & pollmar <= 31
replace pollmarcat = "31-31.25" if pollmar > 31 & pollmar <= 31.25
replace pollmarcat = "31.25-31.5" if pollmar > 31.25 & pollmar <= 31.5
replace pollmarcat = "31.5-31.75" if pollmar > 31.5 & pollmar <= 31.75
replace pollmarcat = "31.75-32" if pollmar > 31.75 & pollmar <= 32
replace pollmarcat = "32-32.25" if pollmar > 32 & pollmar <= 32.25
replace pollmarcat = "32.25-32.5" if pollmar > 32.25 & pollmar <= 32.5
replace pollmarcat = "32.5-32.75" if pollmar > 32.5 & pollmar <= 32.75
replace pollmarcat = "32.75-33" if pollmar > 32.75 & pollmar <= 33
replace pollmarcat = "33-33.25" if pollmar > 33 & pollmar <= 33.25
replace pollmarcat = "33.25-33.5" if pollmar > 33.25 & pollmar <= 33.5
replace pollmarcat = "33.5-33.75" if pollmar > 33.5 & pollmar <= 33.75
replace pollmarcat = "33.75-34" if pollmar > 33.75 & pollmar <= 34
replace pollmarcat = "34-34.25" if pollmar > 34 & pollmar <= 34.25
replace pollmarcat = "34.25-34.5" if pollmar > 34.25 & pollmar <= 34.5
replace pollmarcat = "34.5-34.75" if pollmar > 34.5 & pollmar <= 34.75
replace pollmarcat = "34.75-35" if pollmar > 34.75 & pollmar <= 35
replace pollmarcat = "35-35.25" if pollmar > 35 & pollmar <= 35.25
replace pollmarcat = "35.25-35.5" if pollmar > 35.25 & pollmar <= 35.5
replace pollmarcat = "35.5-35.75" if pollmar > 35.5 & pollmar <= 35.75
replace pollmarcat = "35.75-36" if pollmar > 35.75 & pollmar <= 36
replace pollmarcat = "36-36.25" if pollmar > 36 & pollmar <= 36.25
replace pollmarcat = "36.25-36.5" if pollmar > 36.25 & pollmar <= 36.5
replace pollmarcat = "36.5-36.75" if pollmar > 36.5 & pollmar <= 36.75
replace pollmarcat = "36.75-37" if pollmar > 36.75 & pollmar <= 37
replace pollmarcat = "37-37.25" if pollmar > 37 & pollmar <= 37.25
replace pollmarcat = "37.25-37.5" if pollmar > 37.25 & pollmar <= 37.5
replace pollmarcat = "37.5-37.75" if pollmar > 37.5 & pollmar <= 37.75
replace pollmarcat = "37.75-38" if pollmar > 37.75 & pollmar <= 38
replace pollmarcat = "38-38.25" if pollmar > 38 & pollmar <= 38.25
replace pollmarcat = "38.25-38.5" if pollmar > 38.25 & pollmar <= 38.5
replace pollmarcat = "38.5-38.75" if pollmar > 38.5 & pollmar <= 38.75
replace pollmarcat = "38.75-39" if pollmar > 38.75 & pollmar <= 39
replace pollmarcat = "39-39.25" if pollmar > 39 & pollmar <= 39.25
replace pollmarcat = "39.25-39.5" if pollmar > 39.25 & pollmar <= 39.5
replace pollmarcat = "39.5-39.75" if pollmar > 39.5 & pollmar <= 39.75
replace pollmarcat = "39.75-40" if pollmar > 39.75 & pollmar <= 40
replace pollmarcat = "40-40.25" if pollmar > 40 & pollmar <= 40.25
replace pollmarcat = "40.25-40.5" if pollmar > 40.25 & pollmar <= 40.5
replace pollmarcat = "40.5-40.75" if pollmar > 40.5 & pollmar <= 40.75
replace pollmarcat = "40.75-41" if pollmar > 40.75 & pollmar <= 41
replace pollmarcat = "41-41.25" if pollmar > 41 & pollmar <= 41.25
replace pollmarcat = "41.25-41.5" if pollmar > 41.25 & pollmar <= 41.5
replace pollmarcat = "41.5-41.75" if pollmar > 41.5 & pollmar <= 41.75
replace pollmarcat = "41.75-42" if pollmar > 41.75 & pollmar <= 42


**********
** SAVE **
**********

save "merge_contact_networks_full.dta", replace


**********************************************
** PERCENTAGE OF CORRECT FORECASTS BY STUDY **
**********************************************

egen percent_correct = mean(forecast), by(study_id)

duplicates tag study_id, gen(dup)
duplicates drop study_id, force
drop dup

save "percent_correct.dta", replace